Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Install macOS Sierra in VirtualBox on macOS host

Step 1 (Creating a bootable macOS Sierra ISO for VirtualBox):

  1. hdiutil attach /Applications/Install\ macOS\ Sierra\ Public\ -noverify -nobrowse -mountpoint /Volumes/install_app
  2. hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
  3. hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
  4. asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
  5. rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
  6. cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
  7. cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/BaseSystem.chunklist
  8. cp -rp /Volumes/install_app/BaseSystem.dmg /Volumes/OS\ X\ Base\ System/BaseSystem.dmg
  9. hdiutil detach /Volumes/install_app
  10. hdiutil detach /Volumes/OS\ X\ Base\ System/
  11. hdiutil convert /tmp/Sierra.cdr.dmg -format UDTO -o /tmp/Sierra.iso
  12. mv /tmp/Sierra.iso.cdr ~/Desktop/Sierra.iso

Step 2 (Installing in VirtualBox)

This is pretty straightforward.

  1. Create a new El Capitan (there is no option for Sierra at the moment) machine. Leave everything at default
  2. Boot the virtual machine from the Sierra.iso you created, which you'll find on your desktop. I had to mash F12 while the machine was starting up and then choose 'EFI CD/DVD' in the boot manager. YMMV.
  3. The install process should be familiar to you. If not, you probably shouldn't be playing with a beta OS ;)
  4. Grab a coffee, the 15 minute estimation the installer gives you is a complete work of fiction. My install took over an hour.
  5. Once installed, reboot and complete the new user process. Skip the AppleID login bit, it'll fail on a VirtualBox.
  6. Shut down the virtual machine and quit VirtualBox.

TeodorKolev commented Feb 7, 2017 edited

I have done steps from 1 to 12 and I get: Disk image is corrupted

If you get a black screen when starting the VM, change the Chipset to PIIX3. In the Installer, open the Disk Utility and Erase the virtual disk before installing.

blimmer commented Apr 23, 2017

I followed these instructions and I get stuck at this screen:

gIOScreenLockState 3, hs 0, bs 0, now 0, sm 0x0

anyone have ideas?

Same issue here. Any solution for you yet?

Having the same issue guys, but I also tried a different image creation technique and a few other settings.

Instead of this script, I just created an 8GB RW DMG, mounted it, and used sudo Install\ macOS\ --volume /Volumes/Install\ macOS\ Sierra/ --applicationpath /Applications/Install\ macOS\

Then I unmounted the disk, and used VBoxManage convertdd Install-10.12.4.dmg Install10.12.3.vdi to create a vdi from it. Added that to my VM and...

...exact same results as this method.

To avoid the black screen, I found I had to increase video mem from 16 to 112 or more. But it still stalls out at the same point. The log provides no useful info.

Hi there,

The problem I guess is in macOS Sierra installer 10.12.4

I used the above technique with previous version of installer 10.12.3 and works with no problems. Then you can just download and install combo update for latest one, which is 10.12.5 these days and thats it.

si294r commented Jun 7, 2017

Hi @mcmanole,

Where i can get macOS Sierra installer 10.12.3 ?

trying to make a iso for the new 10.13 beta but get stuck at the step:

asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase

get the error:

Could not recognize "/Volumes/install_app/BaseSystem.dmg" as an image file
Could not retrieve scan information - Invalid argument

it seems that the install ESD does not include a BaseSystem.dmg anymore ... from what I can see it only includes the following:


not sure where to go from here but would be great to get a high Sierra version working on a VM for some testing.


mabam commented Jul 3, 2017 edited

The following worked for me:

Create the ISO for VirtualBox as described here (luckily I already downloaded Sierra in January, so I have version 10.12.2 and don't run into problems as mentioned by McManoli).

Then perform step 3 and 4 from this guide: (don't use the downloads provided there).
Except that in step 3, you create a blank image i.s.o. using an existing one. And in step 4, add the ISO created above as optical medium and change the MAC address of the network adapter to a random one of the addresses found here: .

The following lines are based on step 5 of above mentioned guide:

cd /Applications/
VBoxManage modifyvm "macOS Sierra" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
VBoxManage setextradata "macOS Sierra" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"
VBoxManage setextradata "macOS Sierra" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "macOS Sierra" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "BOARD-PRODUCT"
VBoxManage setextradata "macOS Sierra" "VBoxInternal/Devices/efi/0/Config/DmiSystemSerial" "SERIAL"
VBoxManage setextradata "macOS Sierra" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "macOS Sierra" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1

Substitute "macOS Sierra" by your VM name. "BOARD-PRODUCT" and "SERIAL" have to be substituted by values obtained by Chameleon Wizard. You could use a different "System Product" than "iMac11,3". See on how to obtain the correct information from Chameleon Wizard (ignore the rest of the guide as it is not for VirtualBox).

(See under "modifications" on how to change the resolution.)

Enter your version of the above lines in Terminal one by one.

Start the VM and install Sierra.
I have added 3D-acceleration afterwards.

You can even log in with your Apple ID and also authorize iTunes. My host system is too old to backup or update my iPhone, so I do that using this Sierra VM.

If you have already installed Sierra as a VirtualBox VM, add the lines above (make sure you don't create duplicates) and enter into Terminal:
sudo rm /Library/Preferences/
sudo launchctl load -w /System/Library/LaunchDaemons/
(Taken from )
Restart the VM and you should be able to use your AppleID.

• During startup Sierra reports no valid driver for the USB 3 interface. I had trouble updating my iPhone when using USB 3. So I set it back to USB 2.
This one is a bit specific:
• When updating iOS you sometimes have to reconnect the iPhone manually via the menu a few times. If you have iTunes installed on the host as well, make sure to delete the from the login items of the host first or you go crazy.

I'm new, so apologies if this is obvious or already asked in a different way. I'm getting errors about legacy APIs, shown in the attached image. I have no idea how to fix that or what the root of the problem is. Does anyone know?

screen shot 2017-08-15 at 11 08 09 am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment