Prerequisites
- a macOS Catalina ISO or vmdk file
- VirtualBox v6 or more
- VirtualBox Extension Pack which has USB 2.0 and 3.0 support
Create a new VM
- Name: for example: macOS
- Type: Mac OS X.
- Version: Mac OS X (64-bit)
- Memory Size: around 50% of your physical RAM availability, so if your computer has 8GB RAM select 4GB.
- Hard Disk: Create a virtual hard disk of 100 GB or use an existing vmdk image if you have one.
Edit the VM
- System, Motherboard, Chipset: ICH9
- System, Processor, Number: 2
- System, Processor, Enable PAE/NX: True
- Display, Video Memory: 128 MB
- Display, Graphics Controller: VMSVGA (this allows to use VMWare display driver, more on this later)
- USB : Choose USB 3.0 (xHCI) Controller
Patch the VM
In a Command or Powershell prompt:
cd "C:\Program Files\Oracle\VirtualBox\"
VBoxManage.exe modifyvm "Your VM Name" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
VBoxManage setextradata "Your VM Name" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"
VBoxManage setextradata "Your VM Name" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "Your VM Name" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata "Your VM Name" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "Your VM Name" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
Start the VM
Finally time to boot it up! If you have a vmdk already setup, you will directly get the final installation steps; otherwise you need to run the install from the emulated CD drive / ISO. This is rather straightforward, I won't elaborate here, please check the sources below for more information. Likewise, you will be able to choose the region, timezone, keyboard and fill all the basic information needed to run macOS. You will also create a password that can be blank although it is not recommended.
Troubleshooting
This is the interesting part! I got quite a few problems with the VM, some still unfixed. Let's start with the guest additions, that provide better integration (such as shared clipboard and the likes) and seems to fix the network issues.
VirtualBox guest additions
Fast forward: there is a chance that installing the additions fail because system extensions installation is blocked. To fix that, one needs to go to Recovery mode and run some sudo commands. To get the Recovery, you normally hold Command and R keys during the boot process. It never worked for me. Luckily, you can also enable this by running, in a prompt:
sudo nvram "recovery-boot-mode=unused" sudo reboot
After that, go to Utilities (in the Apple top bar menu) and select Terminal. From there:
spctl kext-consent disable
It should then say:
Kernel Extension User Consent: DISABLED
Please restart for changes to take effect.
To make sure recovery mode doesn't stick (it should not, but just in case)
nvram -d recovery-boot-mode
After a reboot and back in the regular environment, insert the VirtualBox Guest Additions ISO CD from the VirtualBox menu and execute VBoxDarwinAdditions.pkg
Network
The whole intent was to be able to test a website, halas the macOS guest would detect the network card and its virtual cable, but wouldn't go any further. Network stats would show a flat 0 byte sent / received, meaning it didn't even try to reach a DHCP or whatever. I got it working since, but I'm not 100% sure how. What I did: install the VirtualBox guest extensions (see below), and let the Network Adapter to NAT in the VM parameters (all other modes didn't work). The Network Adapter itself is set to Intel PRO/1000 MT (82545EM). I'm quite sure I had to reboot from time to time, too, when connectivity was lost.
Display
Display is stuck at a very low 1024x768 resolution and not resizeable.
During VM setup we chose VMSVGA to have a VMWare compatible display. Installing the VMWare tools is supposed to fix. I couldn't get this to work properly. Tools seem to install, but there is absolutely no perceivable change.
An alternative seems to hardcode the resolution to something higher (still without resize) but I didn't try that:
cd "C:\Program Files\Oracle\Virtualbox" VBoxManage setextradata “Your Virtual Machine Name” VBoxInternal2/EfiGraphicsResolution 1280x1024
Other allowed resolutions are 1280×720, 1920×1080, 2048×1080, 2560×1440, 3840×2160, 1280×800, 1280×1024, 1440×900, 1600×900.
Sources
- https://techsviewer.com/install-macos-10-15-catalina-on-virtualbox-on-windows-pc/
- https://www.geekrar.com/how-to-install-guest-tool-on-macos-on-virtualbox/#Install_Guest_Tool_on_macOS_Catalina_on_VirtualBox-2
- https://intozoom.com/install-macos-catalina-iso-virtualbox-windows-pc/
- https://apple.stackexchange.com/questions/367336/macos-boot-to-recovery-mode-command-line
- https://osxdaily.com/2010/08/03/list-all-third-party-kernel-extensions/
- https://discussions.apple.com/thread/8087342