====== MacOS in a Vagrant Virtual Machine ======
Adapted from https://www.howtogeek.com/289594/how-to-install-macos-sierra-in-virtualbox-on-windows-10/
hdiutil create \
-o /tmp/Mojave.cdr \
-size 2g \
-layout SPUD \
-fs HFS+J
hdiutil attach \
/tmp/Mojave.cdr.dmg \
-noverify \
-nobrowse \
-mountpoint \
/Volumes/install_build
asr restore \
-source /Applications/Install\ macOS\ Mojave.app/Contents/SharedSupport/BaseSystem.dmg \
-target /Volumes/install_build/ \
-noprompt \
-noverify \
-erase
hdiutil detach \
/Volumes/macOS\ Base\ System/
hdiutil convert \
/tmp/Mojave.cdr.dmg \
-format UDTO \
-o /tmp/Mojave.iso
Install ''dmidecode'' for MacOS from http://cavaliercoder.com/blog/dmidecode-for-apple-osx.html by running:
brew install cavaliercoder/dmidecode/dmidecode
Then run ''dmidecode -t system'' and ''dmidecode -t baseboard'' to get values for ''DmiSystemVersion'' and ''DmiBoardProduct'' below. Then customise the VM's CPU identity sets and DMI data.
VBoxManage modifyvm "MacOS Mojave" \
--cpuidset 00000001 000306a9 04100800 7fbae3ff bfebfbff
VBoxManage setextradata "MacOS Mojave" \
"VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "MacBookPro14,3"
VBoxManage setextradata "MacOS Mojave" \
"VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "MacOS Mojave" \
"VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Mac-551B86E5744E2388"
VBoxManage setextradata "MacOS Mojave" \
"VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "MacOS Mojave" \
"VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1