This is a neat little trick I learned while using MAMP over a network that I wanted to share. It is not intended to be a post for beginners, but for someone who already knows how to use mamp and setup a database.
If you want to browse your working files in MAMP you normally open your browser and navigate to http://localhost/. This fine until you want to view the project on a different machine or a virtual machine for that matter. This trick will help 🙂
Open up MAMP, go to preferences, click on PORTS, and change your APACHE port to 80.
You will need to input your system administrators password to get this to work, but now everyone on your local network (eg. Connect to the same wifi network) can access your dev environment by putting the IP address of the dev machine (the one with MAMP running) in their browser. You can get your IP address from System Preferences -> Network (it normally looks like 196.xxx.xxx.xxx)
This is a good trick in itself, but there are several problems with using an IP address when doing local network development with MAMP.
- IP address’s are hard to remember and easy to get wrong.
- IP address’s tend to change unless you set them manually.
- Even if you set your IP address manually, moving to a different network could cause problems.
- Also each time you change your development URL you will need to update any databases with the new URL which is a pain.
- In some instances browsing to your own IP address doesn’t work and most work around would result in a new IP address (time to update your database again).
But there is a neat fix for this problem that you can do on your Mac. If you go to System Preferences, click on Sharing, then just under and next to your computer name there is an Edit Button.
Click that and you can change the local access name of your mac. Change this to whatever you like, eg “nick” and anyone on your local network can then access your dev environment (eg your local wordpress site) through a much friendlier URL like http://nick.local/
The main advantages being that you do not need to update databases with new URLs, it’s easy to browse to a dev environment and your computer is named properly on the network.
But this trick brings with it it’s own (be it small) security risks, and you will need to input your administrators password each time you open and close MAMP. But there is another neat trick to get around that too.
Damian Gaweda wrote a post about running MAMP on port 80 the easy way and provided a very simple solution.
- Open the Keychain Access app and click ‘+’ to add a new item. Call the item ‘MAMP’ and enter the account name and password that you use to log in to your Mac.
- Download and launch the Apache & MySQL – No Password app