Install OSX 10.13
- Create a new VM with the 10.13 template. Accept the defaults, with the exception of RAM (at least 3 GB), number of vCPUs (at least 2) and amount of HD (according to your needs, no less than 10 GB). Also make sure that USB3 controller is selected under the Ports » USB. Choose the newly created ISO as your boot medium.
NOTE: Do NOT designate your virtual HD as an "SSD". The installation WILL fail if you do that, because the OSX installer will convert the filesystem to APFS, something that the VirtualBox EFI can not handle. - Start the VM. It may seem that the installation stalls but don't shut the VM, be patient. Specifically, right before you switch to the graphics with the Apple logo and the progress bar, you'll get stuck at the point where the OSX ≥ 10.12.4 gets stuck:
IOConsoleUsers: gIOScreenLockState 3, hs 0, bs 0, now 0, sm 0x0
- After selecting the language, open "Disk Utility". For reasons that only Apple engineers understand, you will *not* see your hard drive! Instead you'll see a bunch of partitions that are of no interest to you whatsoever (see NOTE below). On the top-left side, click on the "View" drop-down and select "Show All Devices". Now you'll see your "VBOX HARDDISK Medium". Select it and choose "Erase" from the toolbar. Leave the defaults (HFS+J/GUID), except maybe the name, choose anything you like. Quit "Disk Utility" once done.
NOTE: This "glitch" has been fixed with 10.13.2. Now the hard disk shows properly when Disk Utility is opened. - Select "Install macOS". Continue and agree to the license. This will start a phase where the actual installer is copied to the Recovery Partition of the hard disk that you selected. That part is rather quick, lasting less than a couple of minutes on an SSD drive. After that your VM reboots. But, you won't re-boot into the OSX installation phase, you'll restart the whole installation again from scratch! Houston, we have a problem!!! If you're observant, you'll notice a quick message coming up, right before the VM boots again from the ISO to restart the whole installation process:
Boot Failed. Mac OS X
- Apple (another wise move) has modified the way that it reads/treats the different partitions in the EFI, something that currently VirtualBox cannot handle (as of 5.2.2). But, there is a solution. Once you find yourself up and running, right after the language selection step, shut down the VM and eject the 10.13 ISO that you booted from. Then boot the VM again. You get dropped in the EFI Shell.
- You need to keep resetting the VM (HostKey+R) and press any key until you get into the EFI menu screen. If you don't succeed, and you end up in the EFI shell, enter "exit". That will you get to the EFI menu, shown below:
[attachment=2]EFImenu.png[/attachment] - Select the "Boot Maintenance Manager" option, then "Boot from File". Now, you should have two options. The first one is your normal Boot partition, but this is not yet working, because you haven't yet installed 10.13. This is where the VM should be booting up from normally, and this is why it fails to boot. The second partition however is your Recovery partition. This is the one you should boot from to do the installation. This could be also used to do a re-installation of 10.13, just like on a real system, should the need arise.
[attachment=1]BootFromFile.png[/attachment] - Choose the second option, then "<macOS Install Data>", then "Locked Files", then "Boot Files", and finally "boot.efi" and let the games begin!
[attachment=0]boot.efi.png[/attachment] - That second part of the installation is where 10.13 actually gets installed. This is going to take substantially more time, about 20-30 min with the VM consuming every available CPU cycle. The VM will reboot a couple of times but you should be all set.