Install OS X on VirtualBox (on OS X)

You may also like...

54 Responses

  1. Wes says:

    Nicely done! I’ve seen several instructions on trying to get this to work; yours is the first that -actually- does.

    Many thanks!

  2. Eddie says:

    Great write up. This guide is the only one that worked for me. Using El Cap host and guest on VirtualBox Version 5.1.4 . Nice one!

  3. mbigras says:

    I was able to follow this tutorial and get El Capitan up and running with only a few snags:

    1. On Step 5 I think there is something wrong with the syntax to remove the broken link, I ended up just opening it in finder and trashed it.
    2. There’s a bit of a typo on Step 7, some of the html got stuck in the expression

    Besides that it all seems to be working so far :)

    • riccardotramma says:

      I removed the html that the editor sneakily inserted :).
      For step 5 you need to ensure that the name matches, and I know that spaces in the name could create some issues/confusion. Anyway yes, the main goal is to remove the broken link, so using finder to remove it works as well.
      I’m glad to hear that it worked for you as well.
      Thanks for the comment mbigras.

  4. GM says:

    Thanks a lot! Your instructions worked fine with macOS Sierra.

  5. Nick says:

    fantastic, works a treat for Sierra! So many bad guides out there!

  6. Brian H says:

    This is an outstanding resource. I really like how you were able to present the information so that it is very useful for people with a wide range of technical knowledge. Novices can just follow step-by-step and likely get to a successful conclusion. Those with more technical knowledge of OS X can skim through and find the key bits of information they are missing to accomplish the task. The curious (of all types) can benefit from the concise explanations of _why_ these commands and options are being employed. (I’m thinking specifically of the “Create ISO from installer” section.)

    Needless to say, it worked beautifully for me. The only slight snag I ran into was after running the OS X install process, the VM didn’t just shut down, it restarted — without giving me a chance to “remove” the installation iso from the virtual optical drive as you describe in the next step. During the restart, my VM appeared to get stuck and I thought maybe it was trying to boot from the installer iso again. I just powered down (closed) the VM, removed the iso in the settings as you describe, and started the VM again. Success!

    Thank you for putting in the time and effort to make this guide.

    • riccardotramma says:

      Thanks Brian!
      I really appreciate your comment and feedback.
      You got exactly the reason why I write these posts, that are not only aimed at solving the problem but more importantly want to offer an opportunity to understand the concepts behind it if you are technical or simply curious (as you said).

      For the OSX version that you tried to install, was it El Capitan, Sierra or something else?

  7. Christoph says:

    This is an awesome article. Very clear, very detailed, and the first one I found that actually works! (I used it to install Sierra in a VirtualBox on Sierra.) Thank you Riccardo!

  8. Kent says:

    Thanks for this guide! I was really in despair after trying the guide at http://www.starkandwayne.com/blog/running-a-mac-vm-on-a-mac-using-virtualbox/ without luck on Sierra and VirtualBox 5.1 as I got the UEFI trouble you mentioned.
    One thing I ran into still, on Mac Mini 2012, was that the USB controller really have to be USB 1.1 (OHCI). Otherwise it will halt during boot sequence.

  9. Himanshu says:

    Hello! Riccardotramma, I have a problem, While starting vm for very first time, it just repeats its command screen several times i mean, Its a bootloop, Please help how to fix it.

    • riccardotramma says:

      Hi Himanshu,

      check if the settings of the machines are correct. In my case I selected ICH9 Chipset, and checked the three checkboxes: “Enable I/O APIC”, “Enable EFI”, “Hardware Clock in UTC Time”. Not all of them are relevant for the issue you are describing, so I’m just mentioning it to allow you to know how my one is configured.

      I hope this helps,
      Riccardo

    • Brian H says:

      Hi Himanshu. Are you saying that when you start the VM, it reboots itself over and over, repeatedly? If so, then I guess the “command screen” you mentioned is the “verbose” text output of the OS X booting process, because VirtualBox always adds the “-v” boot argument.

      I’ve run a few different versions of OS X and VirtualBox on two machines, but haven’t seen a boot loop like that. If you could look at the last few lines of the text that is displayed on the screen during boot maybe it would help narrow down the cause. (Or, maybe not, because the last message probably tells you the last step that did complete successfully, while the real problem might be more related to the what the NEXT message would have said — but never appears!) — Brian H.

  10. Brian H says:

    Hi Riccardo — I’ve come back to this excellent guide to do another install (reason given later). In the spirit of appreciation I will point out two (very minor) corrections or clarifications for any readers:

    1) In “Create ISO From Installer,” section 7, it says “Ignore the BaseSystem.chunklist file and the two AppleDiagnostic files (we don’t care about these).” But the command lines shown in the next box include
    “cp -rp /Volumes/esd/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/”
    which seems to contradict the statement to ignore that file.

    I did copy that file (as listed in the command box) and it worked fine, but I don’t know whether that file is necessary or not.

    2) At the end of the process the file “OSXInstaller.cdr.dmg” is left over, but not very useful. I believe it may be deleted anytime after the “hdiutil convert…” command.

    I used your instructions with success installing macOS 10.12.2 Sierra as the guest OS in a VirtualBox VM. My host machine is a late 2015 iMac and is running 10.11.6 El Capitan. Currently my VirtualBox is version 5.1.12, the latest right now. I installed Sierra recently because I was unable to update my working El Capitan VM with a recent security update from Apple without getting strange errors afterwards (code signing errors, Finder crashing, etc.). Previous updates had worked fine, though.

    Sierra is now running well, but once again during installation I had a little problem (as I mentioned in comments above) that others might encounter: as part of the normal OS X install procedure, the VM was automatically restarted, and it seemed to get stuck (hang, freeze) during the restart, with a black console screen and a few lines of text (I think). I waited over 30 minutes but it never proceeded.

    So I closed the VirtualBox VM window (this does an abrupt “power off” on the VM), and then started the VM again. This time it booted OK and went through the normal completion of the OS X installation and all appears fine.

    Thanks again, Riccardo, and good luck to everyone!

    Brian H.

    • riccardotramma says:

      Thanks Brian, good spotting ;). I updated the post accordingly.
      Interesting problem the code signing error during a security update. I’ll keep it in mind if I encounter anything similar.
      Once again, thanks your comments and words. Appreciated.
      Riccardo.

  11. Alex says:

    Thanks a lot Riccardo for this posting, it really worked for me installing Mac OS Sierra VirtualBox on a MacBook Pro. However there seems to be a shortcoming, when switching the OSX VirtualBox to Full Screen Mode (Host+F) the window doesn’t expand all the way to the host display. I know that Virtual Box currently doesn’t support additions for MAC. Although there is a pkg file in the ISO for Additions this doesn’t seem to work, do you know any way to work around this?

    Thanks again for your posting and any hint would be appreciated

    Alex

    • Brian H says:

      Hi Alex – I’m not associated with the web page author but have some info that may help you. For a guest OS X (MacOS) in Virtualbox, you must choose one of only six possible screen resolutions that can be set in the EFI (the firmware) for the virtual machine. This is done by a Terminal command like

      ‘VBoxManage setextradata “my-vm-name” VBoxInternal2/EfiGopMode N

      …where N can be one of 0,1,2,3,4,5 referring to the 640×480, 800×600, 1024×768, 1280×1024, 1440×900, 1920×1200 screen resolution respectively.

      Perhaps none of the choices are perfect for your setup — you just have to pick the one that is “best”. If they ever create guest additions for MacOS then there could be other choices. But for now, these are the only ones that work. Here is the section of the manual that describes this better:

      https://www.virtualbox.org/manual/ch03.html#efividmode

      • Alex says:

        Hi Brian

        Your suggestion really helped. There are some warning messages during Virtual Box startup but after all seems to be fine. It’s not possible to get the same resolution as the host display but getting something close to it makes things easier.
        Thanks for your help and the time taking to reply.

        Alex

  12. jose bernal says:

    Hi, I’m using MacBook Air
    I trying to Install a macOS Sierra 10.12 like Guest and macOS Sierra 10.12 like Host.
    2 Processors, 4096 for RAM, 40GB for Hard Disk
    I got this error message: Still Waiting for Root Device.

  13. jose bernal says:

    Hi, I’m using MacBook Air
    I trying to Install a macOS Sierra 10.12 like Guest and macOS Sierra 10.12 like Host.
    2 Processors, 4096 for RAM, 40GB for Hard Disk
    I got this error message: Still Waiting for Root Device.
    Please tell me, possible mistakes.
    Thank you for your valuable Help

  14. jose bernal says:

    Hi Ricardo!
    I found my mistake!

    I replaced your steb
    “hdiutil convert macOSInstaller.cdr.dmg -format UDTO -o macOSInstaller.iso”
    by
    “sudo hdiutil makehybrid -iso -joliet -o macOSInstallerDirectHybrid.iso macOS/macOSInstaller.cdr.dmg”
    using macOSInstallerDirectHybrid.iso for VirtualBox (and the error raise up)

    Then I follow your original step
    “hdiutil convert macOSInstaller.cdr.dmg -format UDTO -o macOSInstaller.iso”

    Later I tryed replacing the rename file
    “mv macOSInstaller.iso.cdr macOSSierraInstaller.iso”
    by
    “sudo hdiutil makehybrid -iso -joliet -o macOSInstallerExtendHybrid.iso macOSInstaller.iso.cdr”
    and the results were (similars, in other words, bad file for installation).

    Later I checked the Sizes file with “ls -al” note (the dates are different because I was confirming the results)

    -rw-r–r–@ 1 josebernal staff 8053063680 Jan 24 02:36 macOSInstaller.cdr.dmg
    -rw-r–r– 1 josebernal staff 8053063680 Jan 25 00:14 macOSInstaller.iso.cdr
    -rw-r–r– 1 josebernal staff 6178375680 Jan 25 00:56 macOSInstallerDirectHybrid.iso
    -rw-r–r– 1 josebernal staff 6178375680 Jan 25 01:09 macOSInstallerExtendHybrid.iso
    -rw-r–r– 1 josebernal staff 8053063680 Jan 24 17:53 macOSSierraInstaller.iso

    then I Compared the files to be used
    “cmp macOSSierraInstaller.iso macOSInstaller.cdr.dmg”
    and the results was are exactly files!

    Then I discover that maybe you don’t need to do
    “hdiutil convert macOSInstaller.cdr.dmg -format UDTO -o macOSInstaller.iso”
    instead do rename the original image file
    “mv macOSInstaller.cdr.dmg macOSInstaller.iso”
    or copy it
    “cp macOSInstaller.cdr.dmg macOSInstaller.iso”
    to preserve macOSInstaller.cdr.dmg file!

    Thank you!!!

  15. Rafa says:

    Hi,

    I have been trying to do install a Sierra guest on top of my my Host (also a macos Sierra Macbook 12” with VirtualBox last version 5.1.14 installed) and I’m not able to start the VM intallation, it freezes during the first boot Installing the VM in the console screen.
    I don’t know why.

    Can you give me some light?

    Regards,

    • Rafa says:

      Hi Again,

      Specifically, it freezes in the following console step:

      Waiting on IOProviderClassIOResourcesIOResourceMatchboot-uuid-media

      Thanks in advance,

  16. jose bernal says:

    Check if you take like base of Installation mac OS El Capitan, I recommend to you, none flavor, only use Mac OS 64 bits… https://forums.virtualbox.org/viewtopic.php?f=22&t=80719

  17. Rafa says:

    Hi José,

    Ok, I’ll give it a try in one or two days and I’ll report here my findings.

    Thank you,

  18. F says:

    Running VB 5.1.14 r112924 on mac OS Sierra and attempting to install a mac OS Sierra guest. I can follow all the directions up until the OS installer stops due to an “unknown error” and asks me to restart and try again (which doesn’t work). Any ideas?

  19. Bimal says:

    macOS sierra dropped the support for Faxing from a USB Modem. Is it possible to extract this “Faxing Module” from an older version of OS X and then use it in macOS Sierra? Your views?

    Thanks
    Bimal

  20. Jean says:

    Thank you Riccardo! I have a couple of questions. I’m new at all this and the first thing I did, as your article suggests, was to create a bootable USB drive with Sierra on it. Now, as I read through the rest of this article, I’m having difficulty understanding how that bootable drive with Sierra on it, plays into all of this. It seems all these steps are being done on my actual Hard Drive, correct? So why did I need to make the USB drive? Just to have a copy of Sierra safely somewhere?

    Thx!

  21. Jean says:

    Thank you Riccardo! I have some questions as I’m new to this and a bit confused. The first thing I did was create the bootable USB drive with Sierra on it, per your instructions. Reading through the rest of this, I don’t understand how that drive plays into all of this. Or was it just to have a bootable copy of Sierra safely away somewhere? It seems the rest of these commands are being done on my actual hard drive, correct?
    Thanks in advance,
    Jean

    • riccardotramma says:

      Hi Jean!

      In this specific case you don’t really need to create a physical bootable USB. The main thing you need in order to install Sierra on a VM is only the installer app.
      So, if you were following the previous article, you can follow it until you have the app downloaded (that happens at the very start, before the section “Prepare the USB”).

      Once you have it, you can continue with this article from “Time to do some magic!”.
      In it, in fact, all the operations are performed on this file (the downloaded one, that I have in the Applications folder: “/Applications/Install OS X El Capitan.app”) that contains the image of the installer disk (“/Applications/Install OS X El Capitan.app/Contents/SharedSupport/InstallESD.dmg“)
      This file (on your mac) is the one we mount in place, simulating an inserted media (in the section “Attach the installer image”). Then everything else continues from there :).

      Thanks for the comment and let me know if this helps :).
      Riccardo

  22. John Harris says:

    Thank you so much for writing this guide, it is the only one I have found that works (El Capitan VM on El Capitan host & VirtualBox 5.1). Thanks again

  23. Jose Bernal says:

    Hi, I was following again for macOS Sierra 10.12.6 but Now it’s not working… for me this post works for macOS Sierra 10.12.3.

    https://www.virtualbox.org/ticket/16644..

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

    You know how fix it?

    • John Smith says:

      That’s the same point that mine is getting held up at.

    • John Smith says:

      Knowing that it works on El Capitan I’ve gone into the App Store and downloaded that. It’s currently installing, I plan on updating to Sierra once it’s done. Hopefully that will work.

  24. fgio51 says:

    Hi,
    Thanks for this clearly lesson.
    I did every steps to create an iso of Sierra installer, all seems working well.
    I created the VM, launched it, loaded the iso, and I get the launch screen with the message “FATAL: No bootable medium found! System halted.”
    That’s 3 days, I tried to create this VM to use software not working on High Sierra…
    Do you have any idea to solve this issue?
    Many Thanks

  25. Will says:

    Many thanks for these clear and informative instructions – I now have a freshly installed 10.12.3 guest running on my 2009 Mac Pro/Mac OS 10.10.5 host :) I had previously built a guest from installing 10.6 server and then disk copying an image of an OS install to another virtual disk – I process that I have never managed to fully replicate!

    I used 10.12.3 in the end as I ran into the same issue as per Jose Bernal’s 2017-08-04 post when trying 10.12.6 – it seems that 10.12.6 doesn’t like vBox’s EFI vendor. Not a huge problem as I am close enough to where I need to be with my VM.

    In step 6 of the ISO creation process, the copy command put the files into the directory /Volumes/OS\ X\ Base\ System/System/Installation ; the accompanying image shows the files in a Packages/ sub-directory, which reflects the original directory structure – I opted to mimic this, which worked fine when I came to install from the ISO.

  26. Sviat says:

    Was very helpful to get the ball rolling and create a proper bootable image, but after I had to deal with the following set of issues, which may be of use to someone else:
    1. When trying to setup the VM on non-apple hardware, you’re likely to face the “DSMOS has arrived” (aka “Don’t steal Mac OS”) message, where boot doesn’t go past that point. Considering that I was installing the VM on my ASUSTOR NAS with headless virtualbox, that added more complexity into the mix. If you’re in similar circumstances, then you would need to
    1.1 Shutdown the VM and SSH into your remote machine, e.g. ssh root@192.188.x.x
    1.2 Locate VirtualBox folder, in my case /usr/local/AppCentral/virtualbox
    1.3 Go into the /bin folder which contains a number of executables that we will use
    1.4 Run the following commands
    ./VBoxManage modifyvm “Your VM Name” –-cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
    ./VBoxManage setextradata “Your VM Name” “VBoxInternal/Devices/efi/0/Config/DmiSystemProduct” “iMac11,3”
    ./VBoxManage setextradata “Your VM Name” “VBoxInternal/Devices/efi/0/Config/DmiSystemVersion” “1.0”
    ./VBoxManage setextradata “Your VM Name” “VBoxInternal/Devices/efi/0/Config/DmiBoardProduct” “Iloveapple”
    ./VBoxManage setextradata “Your VM Name” “VBoxInternal/Devices/smc/0/Config/DeviceKey” “ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc”
    ./VBoxManage setextradata “Your VM Name” “VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC” 1
    Commands taken from this post: http://www.wikigain.com/install-macos-sierra-10-12-virtualbox/
    1.5 Bootup the machine again, you will see the “DSMOS has arrived” message again, but after a few seconds the “Welcome” screen will show up.
    2. The next problem was to get the mouse and keyboard to work, when using remote desktop with the virtual machine. You would need to enable USB controller in the machine settings, which is disable by default for whatever reason: “Settings” => “USB” => “Enable USB controller”. USB 1.0 worked just fine for me. Boot up the machine again, wait for the welcome screen to show up and now you should be able to interact with the guest OS using your mouse/keyboard through remote desktop connection. Mouse positioning will not work well, but we’ll have to persevere through the typical installation process and then install GuestAdditions to fix that in the next step.

  27. Daniel Tacker says:

    I’m following these steps to install a Sierra.ISO in virtual box. Everything works great so far, but once I boot up the virtual machine with the ISO it seems to get stuck on one line.

    “IOConsolUsers: gIOScreenLockState 3, hs 0, bs 0, now 0, sm 0x0”

    And it just hangs here with no more progression

    • Sviat says:

      Didn’t have experience with that error, looks like an issue with one of the drivers during the system boot.

  28. Travers Utt says:

    Thank you Riccardo for taking the time to make this tutorial. Unfortunately I have followed the steps to the letter (several times) with no luck whatsoever. I am on a new iMac Pro, High Sierra 10.13.3, VirtualBox 5.2.8.

    I’ve checked the disk image and it looks good, but the new El Cap VM will not boot from it. The error I am getting is Guru Meditation. Below is the text along with a paste of my complete log. Any help is much appreciated.

    A critical error has occurred while running the virtual machine and the machine execution has been stopped.
    For help, please see the Community section on https://www.virtualbox.org or your support contract.

    https://pastebin.com/raw/jUXVaypJ

  29. James Wilde says:

    This is a much more detailed presentation than most, and I followed your instructions exactly, I hope. I have now tried starting my Sierra guest on my Mac mini running High Sierra twice, and both times it stops at the same point. The last few lines are as follows:

    Prevent idle sleep list: IODisplayWrangler+ (1)
    IOConsoleUsers: time(0) 0->0, lin 0, elk 1,
    IOConsoleUsers: gIOScreenLockState 3, hs 0, bs 0, now 0, sm 0x0

    Dose this give a clue as to what may be stopping the guest from going further?

  30. James Wilde says:

    Just had a thought – can this be caused by the fact that I have two screens attached to the Mac mini?

  31. Doug says:

    What an awesome job on this post! I did this to run some older software which is not compatible with High Sierra. This probably wasn’t the case when this was written, but I had to change the date within Terminal to one in the past (12/22/2014) in order to install El Capitan. I discovered this from a video (https://www.youtube.com/watch?v=wygt8Wiw51E). I didn’t have to put the VM into single-user mode. I just changed it within Terminal and it ran to completion.

Leave a Reply to Alex Cancel reply

Your email address will not be published.

To avoid spam, comments will be verified before being published

This site uses Akismet to reduce spam. Learn how your comment data is processed.