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)
https://bit.ly/DownloadMacOSHS10134
Extract the rar and setup the new VM as follows in VirtualBox
Networking and other options are pretty straight forward, attach the extracted ISO as your boot media, and before we boot make sure to set these in the terminal
$ 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.
Setup the Disk first before installing (Erasing works the best if you don’t care about the defaults) via the Disk Utility
Exit the Disk Utility and Install MacOS, this takes approx 10 minutes and then suddenly reboots (for me this happens when its 2 minutes remaining)
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
Now this will boot and continue with the installation and this time the setup will finish properly, but will take considerably more time than previous run.
And after some time you should have the new MacOS 10.13.4 High Sierra ready in you VirtualBox.
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
And the Network configuration inside the MacOS VM is static as following: