As much as I adore my new MacBook Pro and the perks of OSX, there are those few useful apps that just aren’t offered in the apple flavor. Luckily, OXS comes bundles with a great utility called BootCamp that allows you to install a complete copy of Windows right alongside OSX, and select which OS to boot at startup. But this still requires a reboot very time I need to use windows. The solution, mount the BootCamp Windows partition with the free virtualization software, Virtualbox, and run Windows directly within OSX as if it were just another application. While that sounds awesome, I found it to be a bit more difficult than I first estimated. Now that I’ve got things setup and running perfectly, I thought I’d share my experience so that it may help you skip the headaches I went through.
Step 1: Install Windows using Bootcamp
Just for sake of clarification, these are my system specs
- 2010 MacBook Pro
- Intel Core i5 2.53ghz
- 4gb ram
- 500gb HD 7200rpm
- OSX Snow Leopard 10.6.3
- Windows 7 64bit Professional (This needs to be a full, legitimate copy of the OS)
- BootCamp 3.0.2
- VirtualBox 3.1.6
Here’s Apples own, relatively long, step by step guide to setting up Bootcamp. Make sure to read carefully when you get to “Formatting the Windows Partition” as it caused me a bit of confusion. After installing Windows, reboot back into OSX. Hint: hold the option key while booting to select the OS you want.
Step 2: Setup VirtualBox
VirtualBox is Sun’s (now Oracle’s) free utility that makes creating and launching virtual machines incredibly easy. We’ll use this it to mount the windows installation created with BootCamp. Mr. Anil Dash walks through the steps to make the BootCamp drive useable, but I ran into some troubles that I’ll try to address here.
1. The first thing we need to do is eject the BootCamp partition – Open “Finder”. “Control->Click” the “Bootcamp” drive and select “Eject” (You can also the DiskUtility as well)
2. Now for the geeky terminal stuff to make the BootCamp partition useable within VirtualBox. Open a terminal (located in /Applications/Utilities) and enter the following commands. Make sure to press “Return” after each command to run it.
sudo chmod 777 /dev/disk0s3–Changes the permissions of the BootCamp partition to allow it to be modified (enter your admin password when asked)
sudo VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename win7raw.vmdk -partitions 3–Creates 2 files in your home directory, one of which will be used by VirtualBox to access the BootCamp Partition
sudo chown YOUR-USER-NAME-HERE win7raw.vmdk win7raw-pt.vmdk–changes the permissions of the previously created files (Replace YOUR-USER-NAME-HERE with the current user name)
2. Download and install VirtualBox for OSX
3. Start up VirtualBox, and make a new Windows 7 machine. Stick the with recommended memory sizes for now – you can always increase them later. When asked to select a hard drive, select “Use existing hard disk” and click the browse icon – doing so should bring up the Virtual Media Manager. In the Virtual Media Manager, click “Add” and navigate to your home directory. Here you should find two files that were created earlier. Select “win7raw.vmdk”.
4. Highlight the Windows7 Machine and select “Machine -> Settings” from the menu. Click the “Storage” Icon and change “Type:” to “ICH6″ (My Install would crash with “PIIX”). Click “OK”.
5. Startup your Windows Virtual Machine and watch the magic happen!
Step 3: Create AppleScript
Before you do your party dance, we need to do some more work to really make things happy. With my system, I found that after booting into Windows 7 (not using VirtualBox), I would get a VERR_ACCESS_DENIED error using VirtualBox. What’s happening is Windows (Or maybe BootCamp) is locking permissions of the BootCamp partition when Windows is shutdown. This may be great for security, but it makes our job a bit more difficult. We could change the partition permissions through the terminal each time we wanted to use VirtualBox, but that would be a hassle.
So, I created a quick AppleScript that not only changes these permissions, but also ejects the BootCamp Partition (if mounted) and launches the Windows7 Virtual Machine. Make sure to enter the name of your virtual machine where it say’s YOUR-VM-NAME-HERE. This was my very first excursion into AppleScripting, so I apologize if things aren’t a good as they could be. Check out this AppleScript resource if your confused about creating the script.
--Make the BOOTCAMP Partition writeable
do shell script "chmod 777 /dev/disk0s3" with administrator privileges
tell application "Finder"
if exists "BOOTCAMP" then
--Eject BOOTCAMP Volume if Mounted
do shell script "umount -f /Volumes/Bootcamp" with administrator privileges
--Launch Virtual Machine
do shell script "vboxmanage startvm YOUR-VM-NAME-HERE"
Well, that’s pretty much it. You can now launch Windows 7 in OSX by simply clicking the AppleScript. Please let me know if you have any questions/suggestions. Thanks for reading!