Mar 26 2007

Rails, IE, and Parallels
Comments Off on Rails, IE, and Parallels

More and more web developers are using OS X as their development tool of choice these days. It’s hard not to with excellent tools like TextMate, and the ability to run in a Unix style environment. As much as we’d like to give IE the boot, we know that the browser market share is still dominated by this browser. Web development professionals these days need to make sure their code at least works in Firefox, Safari, IE6, and IE7. This leaves us with two very important browsers which don’t natively run on the Mac. Parallels Desktop for Mac comes to the rescue here to make it just as easy to test the two versions of IE on a Mac as it is on a PC.

We’ll go over the basics needed to test your Rails applications in IE6/IE7 on Parallels in the most convenient way possible.

Getting Started

I’ll start out by saying that the first prerequisite for this setup is having an Intel powered Mac. This article is useless without one unless you’re just here to drool over neat tools.

Being able to use Parallels comes at a cost. You’ll need to shell out $79.99 for a copy of Parallels for Mac, and a couple hundred more for a copy of Windows. I believe this is a nominal business cost for what the software offers, and is much cheaper than having to buy and maintain a separate PC to run Windows. Both Parallels and Windows have a trial versions you can use to verify that this setup is worth your money.

Once you download Parallels for Mac, you can unpack and install the software as usual. Parallels has a great guide for getting started with the software. It will take you through Installing Parallels Desktop, Creating new Virtual Machines, and Installing Windows on the machine. I started out by installing a single Windows XP virtual machine and set it up with IE6 and all other default settings I use. I then just copied that setup to create a new VM on which I upgraded to IE7.

Open Ports on the Network

When developing Rails applications on the Mac, the typical setup is to develop everything on localhost, and serve the applications using mongrel.

$ cd maintainable
$ mongrel_rails start -d -p 3000

We can of course access this directly in our native Mac browsers by navigating to http://localhost:3000. To make this application accessible from IE on our Windows VM, we’ll have to accept network traffic through our firewall on port 3000. Open up your Apple System Preferences and go to the sharing window.

Navigate to the Firewall Tab in the Sharing pane, and click on the New button so that we can add an additional port(s).

Here is where we make our Rails ports available on the network. We’re going to open up ports 3000-3099 for any additional Rails applications we choose to bind to a port in that range. Enter

  • Port Name: Other
  • TCP Port Number(s): 3000-3099
  • Description: Rails Applications (30xx)

Browsing in IE

Now we should be able to browse to this from IE in our Parallels machine by pointing to our internal IP Address. We can find out this internal address by taking a look at the Services tab on our Sharing pane. Near the bottom it will say something like “Other Macintosh Users can access your computer at afp://”.

This is the number we’re looking for, and we can alternately find it using this command from the terminal.

$ ifconfig | grep 192 | awk '{print $2}'

Once we have our internal IP, let’s fire up our IE browser and check out our site. In IE, navigate to

Browse By Name with Bonjour

The problem with browsing by internal IP address is that it’s likely to change from day to day. A better approach is to install Bonjour for Windows so that we can simply refer to our computer by name instead of number.

We’ll first go back into our Services tab on the Sharing pane in Apple System Preferences. Here we’re going to shorten our name to be something easy to remember and type into the browser. Click on the Edit Button near the top.

I’m going to simply rename this to derek.local. Feel free to be more creative with your own.

To seamlessly network with our Windows VM without the hassle of dealing with network settings manually, we’re going to install Bonjour for Windows. Download BonjourSetup.exe, and choose the default settings for the installation. With Bonjour installed, we can now browse to our application at http://derek.local:3000.

Sorry, the comment form is closed at this time.