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-coreCPU
- Min 4 GB RAM
- Min 40 GB HardDisk
- Min 128 MB VboxSVGA with 3D acceleration enabled
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