Setup MAMP and Parallels to test Windows browsers on Mac

Had to figure this out earlier today and figured others might be looking for an answer too. I am assuming that:

  1. You are using MAMP with the default ports (80 for Apache)
  2. You are using Parallels with Windows 7 (although these steps should work for older versions too)

Step 1: Setup your local environment with MAMP

This step is pretty straightforward. If you put your website in /sitename should be able to load it at http://localhost/sitename/.

Here’s a helpful tutorial. Don’t forget to set your Apache and MySQL ports to the default 80 and 3306.

Step 2: Figure out your Mac’s IP address on the network

Go into your Mac’s Network Preferences. You’ll see 2 or more connections on the left and the active one will say Connected. Click on it and you’ll see the IP address on the right side of the pane.

To make sure your Mac’s IP address doesn’t change, click on Advanced → TCP/IP. The options sheet below appears.

Network_Preferences

Change the IPV4 option to Using DHCP with manual address and type in an unused IP address. In the example above I used 192.168.1.100.

Step 3: Edit your Windows hosts file

Click the Start button and search for Notepad. Right click on the result and select Run as administrator. Enter your password and Notepad will launch.

In Notepad, click File → Open and browse to C:WindowsSystem32driversetc. In the bottom right of the Open window, change the file type to All Files. The hosts file will now be visible and you can open it in Notepad.

Windows_hosts_file

At the bottom of the file, type:

<your IP>    localhost

Where is the IP address from Step 2. This will tell Windows that every time you want to visit http://localhost/, the location is at . When Windows loads goes to ask for the website, MAMP answers and delivers your local site from the Mac – magic!

You can add more entries for each host you have. In the example above I also have mysite.local. If you want to set up your hosts that way, read up about setting up virtual hosts in MAMP. Or buy the Pro version – it’s worth it.

Save your hosts file, making sure not to add .txt to the end of the filename.

Step 4: Point your browser at http://localhost/sitename/

Now open up Internet Explorer (any browser on your Windows virtual machine) and navigate to http://localhost/sitename/. You should see your local site. Huzzah!

If that doesn’t work…

  1. Try restarting everything.
  2. Flush your DNS cache on the Windows virtual machine.
  3. Try changing your virtual machine’s network connection. I have mine set to Shared Network and it still works fine, but I’ve seen other tutorials that say to change it to Bridged.

Happy browser testing! (If there ever was such a thing 😛 )

Leave a Reply

Share This