Install macOS High Sierra with VirtualBox on macOS
Step 1: Search and Download macOS High Sierra from App Store.
Step 2: Download VirtualBox from VirtualBox’s Official Website: https://www.virtualbox.org/wiki/Downloads , select the OS X hosts.
Step 3. Double click the VirtualBox-5.2.18–124319-OSX.dmg, then double click the VirtualBox.pkg file to install.
Step 4: Don’t panic, if you have this issue when installing VirtualBox:

Navigate to System Preferences — Security & Privacy — General, and then Click the lock icon 🔒 in the bottom left corner, enter your password (which is the one you log in to your Mac).
And then click ‘Allow’ next to the ”blocked from loading” message. Re-run the VirtualBox installer. It should succeed.

Step 5: Download the macOSHighSierra_Bootable.sh file to your Mac, and open Terminal (which can be found via Applications — Utilities — Terminal or search Terminal via Spotlight) and enter the following command:
sudo chmod 755
And then drag and drop the macOSHighSierra_Bootable.sh file to Terminal, here is how it looks like:
Vincents-Mac:~ vincent-st$ sudo chmod 755 /Users/vincent-st/Desktop/macOSHighSierra_Bootable.sh
Then press enter (return) key.
Next, enter sudo in Terminal, and drag and drop the macOSHighSierra_Bootable.sh to Terminal, then press enter (return) key. Press Y key when you see the message “If you wish to continue type (Y) then press return: y”.
And then wait about 2–5 minutes. Don’t do anything until you see the message created: /tmp/HighSierra.iso.cdr in Terminal.
Here is how it looks like:
Vincents-Mac:~ vincent-st$ sudo /Users/vincent-st/Desktop/macOSHighSierra_Bootable.sh
created: /tmp/HighSierra.sparseimage
/dev/disk2 Apple_partition_scheme
/dev/disk2s1 Apple_partition_map
/dev/disk2s2 Apple_HFS /Volumes/install_build
Ready to start.
To continue we need to erase the volume at /Volumes/install_build.
If you wish to continue type (Y) then press return: y
Erasing Disk: 0%… 10%… 20%… 30%…100%…
Copying installer files to disk…
Copy complete.
Making disk bootable…
Copying boot files…
Copy complete.
Done.
“disk2” unmounted.
“disk2” ejected.
Reading Driver Descriptor Map (DDM : 0)…
Reading Apple (Apple_partition_map : 1)…
Reading (Apple_Free : 2)…
Reading disk image (Apple_HFS : 3)…
…………………………………………………………………..
Elapsed Time: 28.821s
Speed: 284.2Mbytes/sec
Savings: 0.0%
created: /tmp/HighSierra.iso.cdr
Step 6: Open VirtualBox and follow the following steps:



Step 7: Select Disk Utility, when you navigate to macOS Utilities.

Select “VBOX HARDDISK Me…”, and click “Erase”, give the virtual disk a name whatever you like.

Close Disk Utility, when the erase process was finished. Then choose “Reinstall macOS” — Continue — Agree to the terms of the license agreement — Choose the previously virtual hard disk you created, then click “Install”.

After several minutes, your Mac will reboot automatically. But there will be an error message “Boot Failed. Mac OS X” .
Well, that’s because VirtualBox couldn’t recognize the new disk, containing a second EFI, which can be booted into.
Shut down the virtual machine. Press the fn and F12 keys very fast in the same time, when you start virtual machine again. It will turn to the VirtualBox boot manager. You are on the right track, if you see the following interface:

You may do it again, if you Mac goes to macOS Utilities. Make sure you press the fn and F12 keys very fast, once you click the Start button to start your virtual machine.
Select Boot Maintenance Manager — Boot from File — [PciRoot(0x0)/Pci (0x1F, 0x2) /Sata (0x0, 0x0, 0x0) /HD(2,GPT, …………]

Then click macOS Install Data — Locked Files — Boot Files — boot.efi. Bingo, you are free to go.

When the installation was done, navigate to Settings — System — Motherboard, move the Hard Disk to the top Boot Order, or deactivate the Optical Boot Order.

