Had to figure this out earlier today and figured others might be looking for an answer too. I am assuming that:
- You are using MAMP with the default ports (80 for Apache)
- 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
should be able to load it at
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.
Change the IPV4 option to Using DHCP with manual address and type in an unused IP address. In the example above I used
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.
At the bottom of the file, type:
<your IP> localhost
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.
hosts file, making sure not to add
.txt to the end of the filename.
Step 4: Point your browser at
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…
- Try restarting everything.
- Flush your DNS cache on the Windows virtual machine.
- 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 😛 )