Installing OS X in Virtualbox

I know there is a couple guides floating around the internet, but I've gathered information to both install OS X Yosemite (And probably El Captain) on a non-Mac computer, and some performance stuff so that Yosemite doesn't look like a slideshow.


Create Install Disk

This step is the easiest, and comes from frdmn's notes. For starters, we're going to assume that you've already downloaded Yosemite from the App Store (Not a pirated copy!).

  • Start off by installing iesd

    gem install iesd
    
  • And then turn the install program into a usable image

    iesd -i "/Applications/Install OS X Yosemite.app" -o yosemite.dmg -t BaseSystem
    
  • Convert into a sparse image so that you can write to it

    hdiutil convert yosemite.dmg -format UDSP -o yosemite.sparseimage
    
  • Mount the InstallESD, and then double click yosemite.sparseimage or mount with the following command

    hdiutil mount "/Applications/Install OS X Yosemite.app/Contents/SharedSupport/InstallESD.dmg"
    hdiutil mount yosemite.sparseimage
    
  • Copy the base systems into the image

    cp "/Volumes/OS X Install ESD/BaseSystem."* "/Volumes/OS X Base System/"
    
  • Now, we're done the blunt of the preparation work. Go to Disk Utility and control-click or right click the images, and completely eject them. Lastly, you need to convert it back into a compressed image so that you can mount it in VirtualBox

     hdiutil convert yosemite.sparseimage -format UDZO -o YosemiteInstaller.dmg
    

Install in VirtualBox

Note: This does not have to be done on OS X. I've installed it on a Windows 10 system running on an i7 processor. Some information taken from LeaseWeb labs.

Just create an OS X Virtual Machine in VirtualBox, set it with 3 GB of RAM (Or more if you can spare), the default hard drive and settings. Mount the YosemiteInstaller.dmg as an ISO, and then boot from it.

If you are having trouble getting to the installer screen, try the below steps ONE AT A TIME from top to bottom. Unnecessary steps may impact your performance!

  • Change Chipset to PIIX3

    VBoxManage setextradata '<YourVMname>' "VBoxInternal2/SmcDeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
    
  • Change CPU ID

    VBoxManage modifyvm '<YourVMname>' --cpuidset 1 000206a7 02100800 1fbae3bf bfebfbff
    

That's all I can offer you, if you need more help google around! If you find a solution that works for you, feel free to email me it!

Then to change the screen resolution, use the command:

VBoxManage setextradata '<YourVMname>' VBoxInternal2/EfiGopMode <N>

Where corrisponds to the below table:

0 1 2 3 4 5
640x480 800x600 1024x768 1280x1024 1440x900 1920x1200

If you want a more specific resolution, install a bootloader on OS X such as Chameleon or Clover, however please note that it may take some additional configuration and debugging that I cannot ofer you!


Speed up the Virtual Machine

While installing, you'll notice that the OS is super laggy visually. Everything behind the scenes is working perfectly fine, but typing and opening various windows seems to take forever! This is because of a feature called 'BeamOff', which seems to be an implementation for VSync that does not work for emulated graphics cards. Download the utility from InsanelyMac, move it to /Applications, and open it. Now your computer should be running much faster, no more lag (From the mouse cursor and stuff, window minimizing and maximizing is still laggy.) You might want to set it to open at login by adding it to your "Login Items" in system preferences.

And some more performance tips from this reddit post should make it generally usable for a virtual machine. Just enter the following into terminal:

  • Disable opening and closing window animations

    defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
    
  • Disable Mission Control Animations

    defaults write com.apple.dock expose-animation-duration -int 0
    
  • Increase window resize speed for Cocoa applications

    defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
    
  • Don’t animate opening applications from the Dock

    defaults write com.apple.dock launchanim -bool false
    

Source

And now, you should be running a relatively fast OS X Yosemite Virtual Machine! If you need something like iMessage to work, you're better off installing a bootloader like Chameleon or Clover and looking at various hackintosh guides like that.