Tutorial: Setup an Apple MacOS Mojave Virtual Box VM
I needed a MacOS Mojave VM to perform some devel and tests.
Follows my current recipe:
- First register on https://olarila.com, they provide clean/vanilla MacOS images for Hackintosh
- Download Mojave raw image (The advantage is that you can also install in native mode, if your hardware allows it)
- Bunzip and write it on a USB key (at least 8GB)
- Download/Install Virtual Box
- Install Virtual Box Extension pack to have USB 3.0 extensions (may be needed), if it fails from the GUI, you can install manually:
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.2.24.vbox-extpack
- Create a new VM, Mac OSX 64 bits, with at least 30 to 100GB disk size
- Set additional metadata as follows to the VM otherwise issues: (replace "Mojave2" by the name of your VM, remove the sudo as required)
sudo VBoxManage setextradata "Mojave2" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
sudo VBoxManage setextradata "Mojave2" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
sudo VBoxManage setextradata "Mojave2" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
sudo VBoxManage setextradata "Mojave2" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
sudo VBoxManage setextradata "Mojave2" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"
sudo VBoxManage modifyvm "Mojave2" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
- Map your USB stick to a vmdk file: (in my case sdh)
sudo VBoxManage internalcommands createrawvmdk -filename sdh -rawdisk /dev/sdh
- Set other parameters of the VM as follows in the screenshots
Do not forget to map your USB stick for the installation
If you have issues with both Keyboard/Mouse not working, install the USB 3.0 and map a keyboard and mouse to it. (I have 2 keyboard and 2 mouses attached to my computer for this purpose ^^)
Once the VM is started, it will go on the USB stick and it will take some time to boot.
After, you just need to launch the "Disk Manager": partition and format your disk. I installed with HFS plus filesystem, I tried the APFS but it failed (I don't know why).
After you launch the installation, it will take less than 30 minutes.
Once the installation is finished, just stop the VM and unmap the USB Key.
Then reboot the VM and it will work directly out of the box.