Install macOS in VirtualBox

First you need an ISO file of the macOS installation DMG. Either download that file from the internet (please be advised to use safe sources) or you follow a tutorial to convert the DMG to an ISO. A tutorial is given here:

https://www.xda-developers.com/how-install-macos-virtualbox

Simply install macOS by adding a virtual machine an selecting the ISO and system as macOS. After the VM was added, change the config as follows:

  • Min 2-core CPU
  • Min 4 GB RAM
  • Min 40 GB HardDisk
  • Min 128 MB VboxVGA with 3D acceleration enabled

Please note that you may need to set the CPU count to 1 for correct installation, otherwise kernel panics can happen! Also set your USB controller to USB 3.0 in case the mac installer asks you for a mouse or keyboard.

Last steps, you need to execute special config commands in terminal:

$ VBoxManage modifyvm "VM_NAME" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff

$ VBoxManage setextradata "VM_NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"

$ VBoxManage setextradata "VM_NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"

$ VBoxManage setextradata "VM_NAME" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"

$ VBoxManage setextradata "VM_NAME" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"

$ VBoxManage setextradata "VM_NAME" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1