Installing MacOS Guest in VirtualBox

| by Ken | in Technology Add comments

I’ve experimented with VirtualBox before but today I had a legitimate work need to try out VirtualBox with a MacOS Guest. So I installed VirtualBox on my Windows 7 64-bit laptop and pulled out my Snow Leopard DVD and… it didn’t work. Nothing could be that easy, right?

I Googled for an hour or so looking for the trick but all the posts I found were about how to work with a drive image or a hacked install or to use special bootloaders that would function as a sort of handoff (such as the Empire EFI which is interesting since it touches on the Hackintosh concepts I’ve talked lots about in this blog). I eventually found the trick I needed at something called “LeaseWeb Labs” in a post titled “How to run OSX in a VM on VirtualBox“.
So here’s what I did:

  1. Install VirtualBox
  2. Create a new VM that is MacOS with the name “osx”; the virtual disk should be something like 25Gb (make sure you have that space on your local computer); the other defaults are fine as is, including leaving EFI checked on
  3. Click the storage section of the settings for the new VM and if it isn’t already included, add in your optical drive: you can click where it says “empty” and then on the right there’s a picture of an optical disc with a tiny triangle below it; click on that and select your optical drive
  4. Exit the VirtualBox application (any running windows including the Manager window)
    open a Windows command prompt and change directory to where VirtualBox is installed
    (on my Windows 7 64-bit, that location is “C:\Program Files\Oracle\VirtualBox”)
    run the following four lines:
    VBoxManage modifyvm osx --cpus 1
    VBoxManage modifyvm osx --vram 128
    VBoxManage setextradata osx VBoxInternal2/EfiGopMode 5
    VBoxManage setextradata osx "VBoxInternal2/SmcDeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
  5. Insert the Snow Leopard DVD and start your osx VM
    you should see the VirtualBox startup, the screen change sizes, and then you are off and running with the install. If you haven’t done a Mac install before, you may discover that you need to run Disk Utilities from the top menu to format the virtual drive and then return to the installer where you would now be able to select the drive you just formatted.

I had a few problems with the resulting install, though. Not the fault of the setup, I don’t think. First, during the install, it appears as though as soon as the screensaver kicks in, the VM display will freeze. I couldn’t figure out how to wake it back up. So it froze during install saying there were “29 minutes remaining” but then it rebooted as part of the install process and came up with the language screen. I was away at the time so by the time I returned, it was frozen again. I rebooted the VM and it came back up fine ready to finish the install. Later I walked away again and when I returned it was frozen again. I didn’t get far enough using the VM to ever figure out how to fix that.

Second, I found it super annoying that the window was just slightly larger than my monitor because either the dashboard was off the bottom of the screen or the mac menu bar was off the top. This is the result of the “EfiGopMode” command above. The 5 sets it to 1920×1200 which is the size of my monitor but VBox doesn’t keep track of the window frame and the menu bar so you end up with scroll bars even if the GOP mode matches your monitor size. To remove the “5”, you’d just run the same command as above without the numeric value at the end. There are parameters to set the specific Horizontal and Vertical resolution but they only work for Linux, not for Mac. Which means the best way to avoid scrollbars is to choose a resolution that fits within your monitor’s limits. I chose “4” in the end.  No resizing on the fly like other OSes.

Third, I discovered after I thought I was all set that the software I wanted to run would only run at Mac OS 10.8 or higher. Okay, I just need to upgrade my 10.6 install so I got the 10.10 updater from the App Store and downloaded that. During download, the screen froze again so I rebooted again. I discovered when running the updater that I was out of disk space in Mac hard drive. No problem, just expand the size of the virtual drive. Strangely, VirtualBox doesn’t make that easy. You have to do that from the command line also (the numeric value is in MB):

VBoxManage modifyhd "C:\Users\kat\VirtualBox VMs\MacOS-VB\MacOS-VB.vdi" --resize 25000

Now, booting up the Mac VM, I could see that the physical drive was larger – cool. All I have to do is drag that partition bar and- wait, there’s an error message. “MediaKit reports partition (map) too small.” It turns out the problem is that the MacOS has built a partition table for that disk that is locked in to the size of the physical disk. But since a virtual disk can change size, it doesn’t handle that correctly. Okay, so how do I resolve this error. I found one post suggesting to boot into single user mode and clear caches and volume table. So how do you do single user mode on a virtual Mac? Another VBox command line of course:

VBoxManage setextradata MacOS-VB "VBoxInternal2/EfiBootArgs" "-s"

(And to take it off later, you would issue the same command but with no args.) That did get me into single user mode where I was able to delete the suggested files but unfortunately, it didn’t resolve the partition problem. There are crazy complicated fixes that I just don’t have the energy for. At this point, rather than struggle to increase the size of the disk, it would just make more sense to do it all over with a bigger virtual disk from the start. But after the hours I’ve spent, I’m already beyond where this exercise of Mac on VBox is useful to me. I’m out.

So sadly, this last issue was terminal for my experiment. But I did want to log the info here for future reference should I ever need to try something similar again.

Leave a Reply

Human Verification *

All content Copyright © Katharsys LLC Created with Wordpress, Theme "Synergy" by Pagelines modified by Katharsys LLC