I and most devs I know really dislike Internet Explorer. We dislike it because it makes our lives needlessly painful by forcing us to pay the “IE tax“: spending time and energy making our web sites work in it.

Yet no matter how we feel about IE, we probably can’t just ignore it (unlike some lucky bastards). To add insult to injury, non-Windows devs have to go through quite a bit of hassle to get IE on their boxes. For instance, here’s what I had to do to get my Mac configured to debug in IE:

1. Install VirtualBox

VirtualBox is an open source VM from Oracle. It’s easy to set up and works pretty well. You can get the Mac image here.

2. Get Windows Images

Greg Norton created a really nice utility which automates installing Microsoft IE virtual machines on VirtualBox. You can install all IE images by running the following command:

curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | bash

Alternatively, you can install specific versions of IE:

curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="7" bash
curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="8" bash
curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="9" bash

Please note that installing these images will take quite a bit of time, especially if you’re installing all of them (it took over 2 hours on my machine).

3. Configure Localhost on Windows

Finally, to make your debugging experience more pleasant, it would help if the Windows VM could recognize a localhost website running on the Mac. For reasons I wasn’t able to clarify, http://10.0.2.2 will allow you to reference localhost.

To make it work correctly, just add the following line in your C:\windows\system32\drivers\etc\hosts file:

10.0.2.2   localhost

Note that I had to set my networking setting in the VirtualBox VM to NAT for this to work correctly. Your mileage may vary.

Sources:

http://osxdaily.com/2011/09/04/internet-explorer-for-mac-ie7-ie8-ie-9-free/

http://stackoverflow.com/questions/1261975/addressing-localhost-from-a-virtualbox-virtual-machine

You may also like:

Did you love / hate / were unmoved by this post?
Then show your support / disgust / indifference by following me on Twitter!

This post got 10 comments so far. Care to add yours?

  1. Conrad says:

    This worked perfectly, thanks.

  2. Giovanni says:

    Thanks ! Worked super smooth.

  3. Elise says:

    When I try to change my hosts file I get a permissions error. Any way to get around this? It doesn’t seem to like you mucking around with the admin user account either.

    • Alex Tatiyants says:

      Hi Elise, I think that you do need to be an admin user on the Windows box to change the hosts file. What’s the exact error you’re getting?

  4. Nick says:

    The addresses for the Windows images have been changed per [https://github.com/xdissent/ievms} to [https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh] (current curl’s as written don’t get anything)

    Thanks so much for the post!

  5. James Cridland says:

    While not quite free, if you don’t have 48Gb free on your little MacBook Air, here’s another way.

    1. Download “CoRD: Remote Desktop for Mac OSX”
    2. Visit “Vaasnet: Virtual Machine Catalog”.

    From Vaasnet, you’ll be able to spin up any version of Windows and any version of Internet Explorer (and/or Firefox), and using CoRD you’ll be able to use the resulting machine in a window on your Mac. At a dollar an hour it’s almost free, and probably saves you the hassle of everything written above. I’ve used these machines every so often for testing purposes, and it’s a great, quick, way of seeing what a mess IE has made of some new code I’ve written.

    (I’m nothing to do with Vaasnet, and have spent a total of $1.30 with them over two years!)

    Hope that helps