A short post here that might help somebody struggling to install the latest MacOS in VirtualBox on Linux. Im running VirtualBox 5.2.10 on X86_64 Linux. The process below can be replicated on Windows as well, but the networking part at the end will of course be different.
So lets first get the MacOS 10.13.4 iso (You can get the DMG and convert it to ISO, but I have little disk space now and just used a ready available ISO from the below link)
Extract the rar and setup the new VM as follows in VirtualBox
I have used “High Sierra” directory name here since this is what I have it called, your can be different (Depends on how you named the VM during creation in VirtualBox)
$ VBoxManage modifyvm "High Sierra" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff $ VBoxManage setextradata "High Sierra" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3" $ VBoxManage setextradata "High Sierra" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0" $ VBoxManage setextradata "High Sierra" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple" $ VBoxManage setextradata "High Sierra" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" $ VBoxManage setextradata "High Sierra" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
Now boot the VM and the MacOS installer will come up after some time.
Now if you don’t do anything the VM will reboot back to the installer, which we do not want. If that happens, simply power off the VM and remove the installation ISO. Now when you boot the VM again you get dropped to an EFI shell. You need to input the following commands to get this going further.
Shell> fs1: FS1:\> cd "macOS Install Data" FS1:\macOS Install Data\> cd "Locked Files" FS1:\macOS Install Data\Locked Files\> cd "Boot Files" FS1:\macOS Install Data\Locked Files\Boot Files\> boot.efi
For Networking I choose the following script to help me interact with the VirtualBox VM and other VMs
#Setup tap and bridge tunctl -t tap0 -u user ifconfig tap0 up brctl addbr br0 brctl addif br0 eth0 vboxnet0 brctl setfd br0 0 ifconfig eth0 10.0.2.1 up ifconfig br0 10.0.2.2 netmask 255.255.255.0 broadcast 10.0.2.255 up brctl addif br0 tap0 vboxnet0 ifconfig tap0 0.0.0.0 sysctl net.ipv4.ip_forward=1 iptables -A FORWARD --in-interface eth0 -j ACCEPT iptables --table nat -A POSTROUTING --out-interface wlan0 -j MASQUERADE
And the networking on the VM is set as follows