VirtualBox is fantastic open-source software that allows you to operate a virtual machine with another operating system. Though it works on most platforms and can run most operating systems, I have a Mac and I needed a Windows OS to run Microsoft Visual Studio. It took a little while to figure out, but here’s a little tutorial on how to run Windows on a Mac for free. I’ll outline the steps to install VirtualBox, set up a virtual machine to run Windows XP, install some extra features, and enable file sharing between the host machine and the virtual machine.
Please note that this tutorial was originally written in September 2010, and was copied over from my old blog. Unfortunately, I can’t guarantee that all techniques and screenshots remain accurate with current versions of the tools referenced below. I have, however, at the time of this posting, tested my links to ensure that they still work and the software still exists. Please leave me a comment if anything looks awry!
Step 1: Install VirtualBox
Grab the install from the VirtualBox website and run it. Setup is simple.
- Run VirtualBox.mpkg
- Open VirtualBox from the Applications folder
After launching VirtualBox, you should see something similar to the below picture. Don’t worry if you don’t have the block on the left that says Windows XP or the information in the main area, that’s what we’re about to create.
Step 2: Set up the Virtual Machine
Now we need to set up our virtual machine settings. Click New in the window shown above. This will launch the New Virtual Machine Wizard. Type in a name for the new virtual machine (just something to identify it) and select the Operating System and version that you wish to run.
Next, it will ask you to select the amount of base memory (RAM) in megabytes to be allocated to the virtual machine. It will say that the recommended base memory size is 192mb, but depending on the ram of your computer, you can make it larger. I have 4gb of RAM, so I set my virtual machine to take 1024mb of it.
The next window will ask you to select a hard disk image to be used as the boot hard disk of the virtual machine. Basically, we need to take a portion of your main machine’s hard drive and use it as the hard drive for the virtual machine. Likely, you will have to create a new hard disk – selecting that option will launch the Create New Virtual Disk Wizard. Just follow the instructions, it’s fairly straightforward. I picked a Fixed-size storage with 32gb of space.
Now you will be presented with a summary of the new virtual machine that will be made. Check to see that the settings are correct and press “Done”.
Step 3: Install Windows OS
Now, if you try to start your new Windows XP virtual machine, you will probably get an error. This is because you need to install the Windows OS on your virtual machine. For this step, you need a Windows install disc or disk image.
Once you have either inserted the Windows disk or you have a disk image of the install on your computer, click Settings in the main VirtualBox window (with the virtual machine Windows XP selected and prior to pressing Start). In the window that opens, navigate to Storage and select the Empty option in the box next to the image of a CD.
If you have a disc of the installation:
- Insert the CD into your disc drive
- Navigate to the drop down next to CD/DVD Device on the right side under Attributes
- Select the first option which should start with “Host Drive..”
If you have a disc image of the installation:
- Select the folder with an arrow next to CD/DVD Device on the right side of the screen to open the Virtual Media Manager
- Add an image to mount to the virtual machine.
Now you’re ready to run the virtual machine! Select the VM in the VirtualBox main window and press Start. Follow the instructions to install Windows XP.
Optional: Install Guest Additions
Guest Additions allows for certain features in your virtual machine. For example, with guest additions, you can move the cursor between the guest and the host without having to escape using a key like the left Command. Guest additions also allows you to resize the virtual machine window and provides better functionality for USB devices. Best of all, it’s easy to install.
- Launch your virtual machine
- Go to Devices (in top bar) > Install Guest Additions
- Follow the instructions
Optional: Set Up File Sharing
You may want to enable file sharing between the host machine and the virtual machine. To do so, you need to define a folder on the main computer as a shared folder that can then be accessed like a virtual drive via the virtual machine. Any file that you place in this folder can then be access by both machines.
In the VirtualBox window, prior to launching the virtual machine, click Settings and navigate to Shared Folders. Add a new shared folder using the button on the right.
Then, launch the virtual machine. Go to the command line terminal (Start > Run, and type “cmd” (no quotes) into the form), and run the following line.
net use x: \\vboxsvr\sharename
Where sharename is the name of the shared folder that you set previously (mine was “Mac-share”). Also, x: can be other letters – this is the drive alias that will be used to access the folder from your explorer. Just be sure not to use a commonly used alias (like C:). X: is usually a good letter to go with.
There you go! Now you should be able to access the folder through the file explorer as a drive and also from the host machine by the actual folder.
Optional: OpenGL 2.0 Support
VirtualBox versions 3+ can run OpenGL 2.0, but you have to change around some settings to get it to do so. With the virtual machine not running, navigate to Settings > Display. Set Video Memory to a value and check the boxes next to Enable 3D Acceleration and Enable 2D Video Acceleration.