How can I install a macOS VM Guest under VirtualBox on a Mac host?

clearlight

How can I install macOS Mojave, macOS High Sierra, and macOS Yosemite as VirtualBox VM Guests on Mac hardware?

clearlight

Here's the configuration I installed:

Late 2015 Retina iMac (probably any new enough Mac will work)
----- VirtualBox 5.2.19 (no foreseeable reason future revs of VirtualBox won't work)
--------- macOS High Sierra 10.13.6 (probably works with several macOS release versions)

  1. First download High Sierra installer from app store. (App store app puts it into /Applications and launches it. The autorun installer can be quit so that it can be converted to an ISO)

  2. You can convert the installer DMG to an ISO, using the script at the end of this answer. Some other approaches work too. You may need or want to tweak the file names or the name of the OS/Installer app depending on what OS you're trying to install, etc...

  3. After creating the ISO, create a Virtual Machine with the following configuration settings:


OS Type: macOS 10.13 High Sierra (64-bit)
Base Memory: 4096 GB RAM
Disk Size: 32 GB disk size
Video RAM: 128 MB
2 CPUs
disable floppy
disable serial port
disable audio

From command line create the following VirtualBox extra data values for the VM.

NOTE: These seemed to be critical for me to get the installer to boot and run.

These extra data settings I found to be omitted from most or all of the Mac installation instructions that I found online. I borrowed these values from Windows VirtualBox install instructions, and modified the system product to match my iMac's (iMac17,1). Without these extra data settings, the installer failed mid-boot, infinitely looping with some error pertaining to trying to reboot MACH).

    VBoxManage setextradata  {vm name or ID} "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac17,1"
    VBoxManage setextradata  {vm name or ID} "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
    VBoxManage setextradata  {vm name or ID} "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
    VBoxManage setextradata  {vm name or ID} "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
    VBoxManage setextradata  {vm name or ID} "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
  1. Point the VM to the ISO you created in step 2, and boot it.

When the recovery partition's GUI comes up (wherein you have the option to reinstall (also used for initial install)), first choose Disk Utility, and find and format (e.g. Erase), the virtual disk you created during the initial creation of the VirtualBox Guest VM. In Disk Utility, the hard disk will show up as a disk on the left. Erase/format it as Mac OS Extended Journaled.

If you don't first explicitly format the virtual disk, the macOS installer will not find any disks to install macOS on. If you haven't formatted the disk, the installer will not err out but will just sit there expecting you to choose a disk, with none listed, and no option to continue with the installation.

After the first reboot during installation, I got stuck at the UEFI shell prompt, which is obtuse and confusing for the uninitiated (i.e. I didn't know what to do about it).

The reason I got dumped in the UEFI boot shell is that macOS wasn't installed yet in the boot partition, and the boot loader doesn't automatically boot into the recovery partition if the first partition isn't valid.

To manually boot/execute code in recovery partition in order to complete the installation, do the following (credit to VirtualBox forums for this information):

  1. At UEFI shell prompt: Type exit
  2. You'll be brought into an EFI text-mode GUI.
  3. Select Boot Maintenance Manager and click.
  4. Select Boot From File and click

You should see a list populated with two cryptic looking entries (PCI bus paths)

The first is the PCI path to a boot partition that is not valid because you haven't installed macOS on it yet. After installing macOS the boot should find that partition and boot normally, without dumping you out at the UEFI shell.

The 2nd partition is the recovery partition, the one you need to boot from to do the macOS installation.

  • Click the 2nd entry, you should see (and then click): macOS Install Data
  • Then click: Locked Files
  • And finally click: boot.efi

At that point the installer boot will continue and you should get to the point where macOS can be installed.

Bash script to convert macOS installer app downloaded from app store to ISO


#!/bin/bash
installer="/Applications/Install macOS High Sierra.app"    
hdiutil create -o /tmp/HighSierra.cdr -size 5500m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierra.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo "$installer"/Contents/Resources/createinstallmedia --volume /Volumes/install_build
mv /tmp/HighSierra.cdr.dmg ~/Downloads/InstallSystem.dmg
hdiutil detach /Volumes/Install\ macOS\ High\ Sierra
hdiutil convert ~/Downloads/InstallSystem.dmg -format UDTO -o ~/Downloads/HighSierra.iso

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

VirtualBox: MacOS host cannot connect to guest, but guest can connect to host

From Dev

How do I install Guest Additions in a VirtualBox VM?

From Dev

How can I access Apache (on VirtualBox guest) from host?

From Dev

In VirtualBox, how can I access host localhost from guest (Visual Studio Dev Server from IE7 testing VM)?

From Dev

In VirtualBox Ubuntu on Windows host can I specify that the Ubuntu guest uses the same MAC address as the host machine?

From Dev

Virtualbox host with no network connection, and guest VM can browse normally

From Dev

Can't ping between guest machines virtualbox MacOS Host

From Dev

VirtualBox - Mac OSX host Win7 guest - no Internet access for guest VM

From Dev

(How) can I use VirtualBox (linux guest) to unlock LUKS and EcryptFS on Windows 8 (host)?

From Dev

How can I transfer files from a Windows 7 host to a Windows 8 guest in Virtualbox without internet?

From Dev

How can I view my virtualbox guest unix filesystem from the host windows file/text editor?

From Dev

Can't install Guest Additions using VirtualBox, Ubuntu guest OS, Win7 host OS

From Dev

How can I access a vagrant guest from another virtualbox guest?

From Dev

How can i setup a guest-guest network connection with virtualbox?

From Dev

Mac OS X as guest on VirtualBox with Ubuntu Host?

From Dev

How do I install VirtualBox guest additions for CentOS 7?

From Dev

How do I install the VirtualBox guest tools on Xubuntu?

From Dev

Virtualbox vagrant guest can not use host DNS

From Dev

Can I install Ubuntu on a laptop as a VM host for various VM guests?

From Dev

When a VirtualBox VM's Adapter is set to Internal Network can the Firewall of the Host Machine Control Access to the guest VM's Ports?

From Dev

How can I get the networking to work offline for a Debian VirtualBox VM in Mac OS X?

From Dev

Using Virtualbox, with Ubuntu as host, do I have to re-install Windows as the guest?

From Dev

How to upgrade to VirtualBox Guest Additions on VM box?

From Dev

Run commands on an Ubuntu guest in VirtualBox VM from Windows host

From Dev

How to boot into UEFI shell on VirtualBox with a macOS guest?

From Dev

VirtualBox: USB hub not detected on Linux Guest - MacOS Host

From Dev

Audio not working on VirtualBox Windows 10 guest (macOS host)

From Java

How to SSH to a VirtualBox guest externally through a host?

From Dev

VirtualBox: How to sync host and guest time?

Related Related

  1. 1

    VirtualBox: MacOS host cannot connect to guest, but guest can connect to host

  2. 2

    How do I install Guest Additions in a VirtualBox VM?

  3. 3

    How can I access Apache (on VirtualBox guest) from host?

  4. 4

    In VirtualBox, how can I access host localhost from guest (Visual Studio Dev Server from IE7 testing VM)?

  5. 5

    In VirtualBox Ubuntu on Windows host can I specify that the Ubuntu guest uses the same MAC address as the host machine?

  6. 6

    Virtualbox host with no network connection, and guest VM can browse normally

  7. 7

    Can't ping between guest machines virtualbox MacOS Host

  8. 8

    VirtualBox - Mac OSX host Win7 guest - no Internet access for guest VM

  9. 9

    (How) can I use VirtualBox (linux guest) to unlock LUKS and EcryptFS on Windows 8 (host)?

  10. 10

    How can I transfer files from a Windows 7 host to a Windows 8 guest in Virtualbox without internet?

  11. 11

    How can I view my virtualbox guest unix filesystem from the host windows file/text editor?

  12. 12

    Can't install Guest Additions using VirtualBox, Ubuntu guest OS, Win7 host OS

  13. 13

    How can I access a vagrant guest from another virtualbox guest?

  14. 14

    How can i setup a guest-guest network connection with virtualbox?

  15. 15

    Mac OS X as guest on VirtualBox with Ubuntu Host?

  16. 16

    How do I install VirtualBox guest additions for CentOS 7?

  17. 17

    How do I install the VirtualBox guest tools on Xubuntu?

  18. 18

    Virtualbox vagrant guest can not use host DNS

  19. 19

    Can I install Ubuntu on a laptop as a VM host for various VM guests?

  20. 20

    When a VirtualBox VM's Adapter is set to Internal Network can the Firewall of the Host Machine Control Access to the guest VM's Ports?

  21. 21

    How can I get the networking to work offline for a Debian VirtualBox VM in Mac OS X?

  22. 22

    Using Virtualbox, with Ubuntu as host, do I have to re-install Windows as the guest?

  23. 23

    How to upgrade to VirtualBox Guest Additions on VM box?

  24. 24

    Run commands on an Ubuntu guest in VirtualBox VM from Windows host

  25. 25

    How to boot into UEFI shell on VirtualBox with a macOS guest?

  26. 26

    VirtualBox: USB hub not detected on Linux Guest - MacOS Host

  27. 27

    Audio not working on VirtualBox Windows 10 guest (macOS host)

  28. 28

    How to SSH to a VirtualBox guest externally through a host?

  29. 29

    VirtualBox: How to sync host and guest time?

HotTag

Archive