Reaching localhost from VMware / virtual machines on a Mac

I’m in the process of setting up a development environment on my mac. I’ve set up IE8 testing by converting Microsoft’s VPC images to a VMware compatible image. So the next thing I need to do is view my local webserver from VMware.

I’m in the process of setting up a development environment on my mac. I’ve set up IE8 testing by converting Microsoft’s VPC images to a VMware compatible image. So the next thing I need to do is view my local webserver from VMware. Typing http://localhost doesn’t work because the virtual machine is an entity in itself so localhost is local to the virtual machine.

Having done a little of this in the past I knew the hosts file in folder c:\windows\system32\drivers\etc would need an entry, mapping my Mac’s IP address to a domain name. Sean Sperte reveals a secret VMware IP address that is particularly handy when you use a laptop because a laptop’s IP address is not likely to remain static. I’ll quote Sean here:

Type ifconfig vmnet1 into a Terminal window. You should get a return like this:

    inet netmask 0xffffff00 broadcast
    ether 00:50:56:c0:00:01

The “inet” number is your “secret” IP (in my case,

Now that we have that number, we can edit the hosts file on the VM. We find it in: C:/WINDOWS/system32/drivers/etc. Just open the host file with Notepad, and add each virtual host (domain) on it’s own line at the end of the document, like so:

… and save. Afterwards refresh the VM’s DNS cache by typing ipconfig /flushdns in a command line window.

This worked perfectly for me.

Using IE6, IE7 and IE8 Virtual PC images on Mac using VM Fusion

Okay, here goes my first blog entry on I switched to a Mac in November 2008 after many years of developing on Windows. At my current place of work I still use Windows but I plan to remedy this by creating a development / testing environment on one machine. I must say that I’m still figuring out how to use my MBP, weening myself of Windows ways on a daily basis.

Most web developers need to test their work on Internet Explorer, version 6, 7 and now 8. If you don’t, you have an understanding, forward thinking client, and one who’s probably missing out on potential visitors / customers. Anyway, I digress. On a PC I use Microsoft Virtual PC to test web pages on each version of IE, by downloading VPCs from Internet Explorer Application Compatibility VPC Image webpage. This method is free but has an annoyance in that the images are time-limited, so one has to download updates every 3 months or so.

Understandably, I wanted the same free method of testing when switching over to Mac. A quick search led me to Mozmonkey’s blog, where he describes how to do just what I wanted. The only killer is that for some of the steps one would need a PC. I don’t have a PC anymore. Comments to the rescue! In the blog’s comments there are lots of helpful hints in how to reach the end goal without a PC. Hooray! So here is my attempt at Mac only install of IE, in this case IE8 Beta 2.

1. Download Microsoft Compatibility VPC Image and extract

  1. Download the appropriate file from Internet Explorer Application Compatibility VPC Image webpage. It’s an EXE file.
  2. On Windows, one would open the file to extract the VHD. Use Zipeg, as suggested by Craig, to unzip the contents of the file you downloaded. Simply rename the extension EXE to ZIP, then open the file in Zipeg.

2. Convert the VHD image to a VMDK image

  1. Download and install Q from
  2. Purely for simplicity, rename your VHD file so it doesn’t have spaces in
  3. Open up a terminal
  4. Navigate to the folder where the VHD file is
  5. Type in the following command, replacing the filenames as appropriate:/Applications/ convert -O vmdk -f vpc XPSP3withIE8.vhd XPSP3withIE8.vmdk

It took a couple of minutes for my MBP to complete this command, after which you should have a VMDK file, suitable fodder for VMware Fusion.

3. Install and configure VMware Fusion with the created image

I don’t have VMware Fusion yet so I’m now going to download the trial version of VMware Fusion. If it works I may buy it.

Installation Done.

  1. Open VMware Fusion
  2. Click File > New
  3. Click the “Continue without disk” button
  4. Select the “Use an existing virtual hard disk” option and find the VMDK file that you created earlier
  5. A warning may popup. If so, convert your disk to the newest format.
  6. Click continue
  7. I chose Windows XP Home as the operating system then hit Finish.

After this, I started Windows XP and attempted to install VMware Tools.

Installing VMware Tools

After several unsuccessful attempts at installing VMware tools I started googling. I found some instructions by Jay Levitt and followed his directions where possible. I had to use keyboard commands because the mouse (trackpad) was not working yet. I did this:

  2. Navigate to Local Policies\Security Options.
  3. On the right is “Devices: Unsigned driver installation behavior”. Change it from “Warn but allow installation” to “Silently succeed”. Close Local Security Policy.

Jay mentions going into regedit but the registry entry Jay mentioned was not present in the version of Windows I downloaded from Microsoft so ignore that’s why it’s not listed above. Next I followed Jay’s steps to remove Microsoft’s Virtual PC drivers:

Now you’ll need your Windows XP installer CD or image.

  1. Press CTRL-Command to escape the guest.
  2. On the Fusion menu bar, select Virtual Machine | CD/DVD | Choose Disk Image… and find your ISO (or insert the real CD into your drive).
  3. The Windows Installer will autorun. Choose “Exit”.
  4. Go to Control Panel -> System -> Hardware Tab. (Shortcut: Command-F15, right-arrow, right-arrow). Click the “Device Manager” button.
  5. Under MSIE6 -> Batteries, you’ll see an Unknown Device, with an exclamation point. Right-click (or use the Action menu) and select “Disable”. Confirm “Yes”. Close the Device Manager and the System panel. My battery driver was okay already
  6. Go to Control Panel -> Add or Remove Programs, and remove the “Virtual Machine Additions” program.
  7. When you see the “You must restart your system” dialog, answer “No”.
  8. Close Add or Remove Programs, and close the Control Panel itself.

I’m not too sure why a disk image is needed. I was lucky enough to have a Windows XP disc sitting in a CD wallet next to me 🙂 Maybe Step 2 above can be skipped or maybe it’s needed in order to remove the Virtual Machine Additions.

Next I followed Jay’s instruction to install VMware Tools:

  1. Press CTRL-Command again, and select Virtual Machine | Install VMware Tools.
  2. A pop-up appears. Click the “Install” button.
  3. In the installation wizard, click “Next”, “Complete”, “Next”, “Install”.
  4. Problem #2: When it tries to install the mouse, it will ask for i8042prt.sys. This is not provided VMware Fusion tools; my other VM doesn’t use this driver for the VMware mouse, and I am not sure why it needs it. However, you can point it at C:\WINDOWS\SYSTEM32\DRIVERS and click “OK”. I didn’t have this problem
  5. Problem #3: When it tries to install the printer, it will ask for pscript5.dll, which is not yet installed, and not on the VMWare Tools CD. Just press ESC. Again, I didn’t have this problem

When prompted, I restarted my system. However, I must point out that each time I try to restart or shut down Windows it hangs on the “Windows is shutting down” screen. To overcome this, I select Virtual Machine > Restart Guest from the VMware menu.

Success! My mouse is working and, unlike Jay did with past versions of the VPC images I had no driver hell. I am able to fire up IE8 and browse the internet. I can’t actually believe this works! Now I just have to do the same for IE6 and IE7, plus workout how to view webpages on my localhost.

I hope my first blog entry helps someone out there.

Update: I’ve worked out how to view web pages on my local development server from VMware.