October 21, 2009
How to run Windows 7 under Mac OS X 10.6 for free
Update: Since this post got a lot more readers than I expected, it's become clear to me that the title was unintentionally vague. I thought it's amazing that a technology I still think of as fairly advanced, virtualizing operating systems on the desktop, has become commoditized enough that free, open source tools are very mature. When I said "for free" here, I meant that virtualization is available at no cost, not that Microsoft's giving Windows licenses away for free. Sorry for assuming that was obvious!
Pardon the uncharacteristically nerdy post, but I thought I'd write up a handy way I'd found to run Windows 7 in a seamlessly-integrated virtual machine under Mac OS X 10.6. I started with these basic components:
- A MacBook running Mac OS X 10.6.1 (Snow Leopard)
- A license for a full install of Windows 7 Ultimate
- VirtualBox 3.08 for Mac OS X
If you're like a lot of geeks that I know, you have a Mac as your main machine, but often need to drop into Windows to check things like browser compatibility or to use some particular Windows applications. I happen to just really like Windows 7 (it's on par with Mac OS overall for me, with some parts being better, such as the Windows Taskbar being much better than the Mac's Dock, and of course some parts being worse.) Some of these instructions may be obvious, but I hadn't seen a writeup anywhere, so here goes.
Here's what you'll need to do:
- Install Windows 7 under Boot Camp, following the normal instructions. All of the Vista drivers for Boot Camp worked fine for me, and the install was actually pretty quick.
- Download and install VirtualBox. This is an open source virtualization system that runs on Mac OS, a lot like Parallels Desktop or VMWare Fusion, but available for free.
- The tricky part: You'll need to do a little bit of geeky stuff. First, eject the Windows boot camp disk in Finder. (It's usually called "Untitled".) Then, launch Terminal so you can enter two commands.
sudo chmod 777 /dev/disk0s3VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename win7raw.vmdk -partitions 3
- Start up VirtualBox, make a new Windows 7 machine, and browse to
win7raw.vmdkin your home directory to choose the virtual hard drive for the machine. Your Windows install should boot up. It'll fuss for a little while as it installs new drivers. - Once that's done, you can optionally install the VirtualBox Guest Additions software to let your Windows install completely integrate with your Mac OS X environment.
While it's not quite as seamless as some of the paid alternatives out there, I've found it was very easy to do (under an hour total, and only 15 minutes or so if you already have Windows installed), works very well, and is speedy enough to use regularly.
As always, your mileage may vary, and comments or corrections or feedback are welcome. I was too lazy to do screenshots of the whole process, but if you want to turn this into a complete gadget blog-worthy writeup, I'll be happy to link to it. If you really liked this how-to, you can buy WIndows 7 from Amazon and I'll make a few bucks.
If you don't need dual boot, you can Windows 7 as a new machine straight into Virtual Box, I've done this without any problems - avoids the terminal voodoo ... Chris
Agree with Chris.
For a little more specifics: create a new blank VM, I suggest give it 1gb of RAM if you have 4gb in your Mac.
Before starting the VM for the first time, from the 'you just created a new VM' use the settings pane on the VM; click on the CD/DVD section and tell it to use either your physical Win7 DVD or your Win7 .ISO.
And away you go!
This approach works in pretty much every VM app, for what it's worth. No terminal jiggery required.
Yep, I shoulda mentioned that. I just like the Boot Camp option too.
The title teases me too much. My hope that I'll read about converting that free Windows 7 VHD into VirtualBox is ruined now. :(
Next time you drop a line of commands on people, take that extra, oh, 5 minutes to write out what the command is actually doing to their system, instead of going "Trust Anil".
Does Windows 7 behave better than XP in a situation where it is run under both Boot Camp (ie. native hardware) and a virtual machine (ie. virtual hardware) with respect to Windows Activation? I have XP installed on my Mac in this way, but as the hardware changes whenever I switch from booting via Boot Camp to VMware and vice versa it keeps wanting to check in with Microsoft... which I am sure means I am going to run afoul of some licensing restriction over at Redmond.
Got this error in Terminal after the second command:
Error opening the raw disk '/dev/disk0': VERR_ACCESS_DENIED
The raw disk vmdk file was not created
I have the same issue as craig.herm above.
Any help here?
@Michael, craig.herm - don't have my system in front of me, but are you sure you are typing "disk0" (as in zero) and not "disko" (as in the Bee Gees)?
@klbostian yes, I am typing 0, the number.
I found this issue on the VirtualBox forum:
http://forums.virtualbox.org/viewtopic.php?f=8&t=19866
It appears that you need to specify the partition (disk0s3, not disk0).
Two questions: Is there any reason this wouldn't work with Ubuntu? And won't Windows detect a difference in hardware and ask for a re-activation?
I was having the same issue but got it to work by running the command with sudo-
sudo VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename win7raw.vmdk -partitions 3
Also, after that, I had to chown it back to my user-
sudo chown win7raw.vmdk
I like to start up the VM and then log into it via remote desktop connection - much more snappy.
I'll have to give the guest OS additions a try.
Hey, thanks for the guide!! I've wanted to do this with my Linux partition for some time, so I'm gonna try this out! I just wish that there was a way of installing Snow Leopard in VB, because it would be great to be able to pop over to the mac side for a program, while still running things on my linux side, and vice versa. ::shrugs::
-dreadpirate15
I guess it's just me, but no where did I discover to run Windows 7 for free.
If you have to have something that costs money, then you can't run it for free; you can't run it if you don't have it.
Sorry I'm grumpy today, but your misleading title and the time I wasted reading the article left me no choice but to leave this comment.
Seriously, you're a good enough writer that this kind of verbal wordplay is, honestly, beneath you.
I've run into the same issue with the disk0. Specifying the partition didn't seem to make any difference.
Albert's solution seems to work until I get to choosing the boot disk in VirtualBox. I click Add, then navigate to the file, but I get "failed to open the hard disk," "could not open the hard disk," and "VD: error opening the image file."
Any ideas? Perhaps I chown-ed it incorrectly?
You can use the installer in VirtualBox directly.
Same issue as Joel. Almost there... Then denied import...
@Joel and @Andrew
Try "sudo [USERNAME] chow *.vmdk"
you need to give yourself back permission on both
win7raw.vmdk and win7raw-pt.vmdk
That's what resolved the issue for me.
That said, I'm now getting a bluescreen of death and a repeating restart whenever I run the VM
That said, I'm now getting a bluescreen of death and a repeating restart whenever I run the VM
Does bootcamp still run alright?
That said, I'm now getting a bluescreen of death and a repeating restart whenever I run the VM
Yes. Bootcamp still runs fine, just the VM image that's bluescreening.
Does this only work for Windows 7? I'm trying it with Vista, but it doesn't seem to boot.
OK, I fixed my issue. I changed the IDE Controller Type to "ICH6" and I was able to boot into the machine. Given that my BSOD was referenced as a HD error on several forums, this makes a kind of sense (I'm still pretty new to using VMs).
Might be other issues to uncover, but for now I'm in. :)
Why is Windows 7 Ultimate required for this? Can't I use it with Home Premium?
There's a VMware solution to this problem for VIsta. I haven't tried it with 7, but it seems like it should work.
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1003426
You activate in Bootcamp, install VMware tools, reboot to OS X, launch inside of Fusion, activate again, and install VMware tools again. It will use 2 activations, but you're allowed 2.
Hi Anil,
Really keen to get this going and I think your guide is great. After dismounting my Windows 7 BootCamp installation drive and copy and pasting the first command it prompts me to enter my admin password. I do this and then copy and paste the second command - It responds with the following error;
Error opening the raw disk '/dev/disk0': VERR_ACCESS_DENIED
The raw disk vmdk file was not created
Any ideas?
Kev
Considering the cost of a Windows 7 license, I wouldn't call this anything close to free.
If you're getting the following error:
Error opening the raw disk '/dev/disk0': VERR_ACCESS_DENIED
just open Disk Utility, right click on your Boot Camp partition, and click "Unmount" then try the command again. You'll need to leave the disk unmounted while using Windows under VirtualBox.
Unfortunately even following a dismount I continue to get that error. Further suggestions?
Wait, "uncharacteristically nerdy"?
Excuse me while I giggle uncontrollably.
:D
Are you using sudo in front of the VBoxManage command as suggested above by albert.volkman? It doesn't work on my machine otherwise.
Aside from that, I can't think of much else. Perhaps your Boot Camp disk isn't disk0s3. In Disk Utility, select the disk and press the Info button. Check to make sure the Disk Identifier is disk0s3. If not, you can change the disk/partition numbers in the terminal commands to match your disk's identifier.
I was getting the same access denied error even after doing the chown of win7raw.vmdk, but i noticed there is a second file win7raw-pt.vmdk I did:
sudo chown [username] win7raw-pt.vmdk
and then i was able to mount the partition
I have the free Windows 7 RC running on VirtualBox (not Bootcamp).
The second command, needs to be preceded by a "sudo", that is:
sudo VBoxManage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename win7raw.vmdk -partitions 3
Doing so will create two files in your home directory called win7raw.vmdk and win7raw-pt.vmdk. Because the second command is run via sudo, the two files created will be owned by root user. Perform the following command to change the ownership:
sudo chown win7raw.vmdk win7raw-pt.vmdk
This will change the ownership of the two files (do not include the "" in the above command).
After that you can proceed to add this to VirtualBox.
Looks like the comment system removed part of the chown command i listed. It should be:
sudo chown your_login_name win7raw.vmdk win7raw-pt.vmdk
is there a way to do this with windows xp too?
Fantastic job guys thank you very much. I'm very impressed with your help :-D
Up and running!
So after all these comments and revisions can someone repost the exact text one needs to input and can you clarify whether it is specific to Ultimate or works on any Win 7 install?
Anyone tried this with SSD disk? Somewhere I get the error VERR_NET_OPERATION_NOT_SUPPORTED ...
And yess I have used both commands preceding with sudo
Somewhere in the back of my head, I remembered that wth ubuntu the disk were mounted in other paths.
Don't know if this happens under Mac OSX?
I'm having the bluescreen of death as well. I'm not sure how changed the drivers that fixed the problem. Could you please explain in more detail what you did? Thanks in advance.
I'm having the bluescreen of death as well. Does anyone have the same issue and have you found a solution?
To get rid of the blue screen problem, go to virtualbox and change the IDE Controller Type to "ICH6. (courtesy of brendan above).
Has anyone else not been able to get sound to work? If anyone has a solution I'd appreciate it.
To get rid of the blue screen problem, go to virtualbox and change the IDE Controller Type to "ICH6. (courtesy of brendan above).
Has anyone else not been able to get sound to work? If anyone has a solution I'd appreciate it.
When I start the VM I get "A disk read error occurred"
I'm able to get it to work, but after booting into Win7 via Boot Camp, I'm not able to get back into the image in Virtualbox.
The error it gives me is that "VERR_ACCESS_DENIED." Anyone else having this issue?
I've found that every time I restart my system (or at least after booting into Win7 via Boot Camp) I need to run the command "sudo chmod 777 /dev/disk0s3" in order for the Virtualbox setup to work.
I'm having the same problem. I execute the second command and get:
Error opening the raw disk '/dev/disk0': VERR_ACCESS_DENIED
I use sudo, and get:
Error while creating the raw disk VMDK: VERR_NET_OPERATION_NOT_SUPPORTED
I'm on Snow Leopard, and VirtualBox 3.0.8.