Access a Macintosh MAMP Server from a VMWARE Virtual Machine

I often use MAMP for Drupal development on my local machine.

MAMP stands for "Macintosh Apache Mysql PHP" and it allows you to operate a local development web server. This provides a simple and easy development platform for web applications and is perfect for Drupal development.

I love my mac, but one problem with developing on the mac is that Internet Explorer isn't available.

I also use Ubuntu often along with various other flavors of Linus in a Vmare Fusion virtual machine.

Since I am already running a web server on my Macintosh, I use the virtual machines to test the performance of the site or application in other native browsers and operating systems.

In order to access the MAMP server though, you will need to modify your hosts file so that you can access it.

Generally, you open a web browser on your mac and type the url: http://localhost:8888/drupalsite

You need to first determine the ip address of the machine running MAMP. Open Terminal and at the prompt type ifconfig The entries will vary depending on you configuration and can be a little confusing. Another alternative method to determine your ip address if you are using an airport is to open the airport preferences and view your dhcp clients. Find the entry for your development machine.

For Ubuntu a modification to your hosts entry is required:

  • locate your hosts file under /etc
  • Find the entry localhost
  • Replace the with the ip address of your MAMP development machine.
  • Now open your web-browser in Ubuntu and visit the url http://localhost:8888/drupalsite

You might run in to a few snags when you try to edit this file, since it is owned by root. A temporary

sudo chown yourusername hosts</chown> should now give you permission to edit the file. Change the owner back to root when you are done editing it.

In windows, the hosts file is located under <code>C:\WINDOWS\system32\drivers\etc

One caveat in using this method is that if your ip address changes, you will need to modify your host file to reflect the new ip address.

Does anyone use a different method? Do you have any comments? Let me know!