CandiceGH / mac-osx-virtualbox-vm

Instructions and script to help you create a VirtualBox VM running Mac OS X.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mac OS X VirtualBox VM Instructions

Current Mac OS X version: Yosemite

To build a VM running Mac OS X, follow the directions below:

  1. Download the Yosemite installer from Mac App Store (it should be available in the 'Purchases' section if you've acquired it previously). The installer will be placed in your Applications folder.
  2. Run the included prepare-iso.sh script (make it executable first, with chmod 755, then run ./prepare-iso.sh from the folder containing the script). A new Yosemite installer iso will eventually be saved to the Desktop.
  3. Open VirtualBox and create a new VM.
  4. Set name, type, and version (set to Mavericks for 'Version').
  5. Follow the rest of the VM creation wizard and either leave the defaults or adjust to your liking.
  6. In Terminal, run the command VBoxManage modifyvm "osx-yosemite" --cpuidset 00000001 000306a9 00020800 80000201 178bfbff (where "Mac OS X" is the exact name of the OS X VM set in step 4) so the VM has the right CPU settings for Yosemite.
  7. To prevent choppiness in the VM, go into settings and uncheck the 'Enable Audio' option under 'Audio'.
  8. Click 'Start' to boot the new VM.
  9. Select the iso created in step 2 when VirtualBox asks for it.
  10. Once the Yosemite installer appears, instead of clicking 'Continue', first go to Utilities > Disk Utility and partition/format the VirtualBox disk as a "Mac OS X Extended (Journaled)" drive.
  11. Quit Disk Utility, and then continue with installation as normal.

When the installation is complete, and you have a fresh new Mac OS X VM, you can shut it down and create a snapshot so you can go back to the initial state in the future. I use this technique to test the mac-dev-playbook, which I use to set up and configure my own Mac workstation for web and app development.

Notes

  • Code for this example mostly comes from VirtualBox forums and this article.
  • I'm currently looking into using Packer (maybe in tandem with Ansible) to automate the process of building an OS X box for VirtualBox. Since the ISO needs to be generated by the end user, it's a bit more involved (i.e. manual download of the original installer image), but not much worse than Packer for linux distros.
  • To install command line tools after OS X is booted, open a terminal window and enter xcode-select --install (or just try using git, gcc, or other tools that would be installed with CLI tools).

Author

This project was created in 2015 by Jeff Geerling.

About

Instructions and script to help you create a VirtualBox VM running Mac OS X.

License:MIT License


Languages

Language:Shell 100.0%