How to start MAMP on port 80 without a password
I’m a big fan of MAMP. It’s the fastest way for anyone to get set up with a local PHP/MySQL development environment on a mac. One of the small annoyances with MAMP is that it requires you to enter your password all the time if you want to run it on port 80 (which I do). To be fair, it’s got more to do with UNIX security than MAMP… but it’s still bloody annoying!
I tried Steve Stringer’s technique of using launch daemons, but it just couldn’t get it to work for me.
The trick to getting MAMP to start behind the scenes is knowing that all that pretty GUI does is call a couple shell scripts. Specifically, those scripts are /Applications/MAMP/bin/startApache.sh and /Applications/MAMP/bin/startMysql.sh (assuming you installed MAMP at the default location).
The second thing you should know is that startApache.sh must be run as root, but startMysql.sh must be run as the current user. I created a new shell script to call those scripts appropriately:
I then added added an exception for that script to my sudoers file so I didn’t need to enter a password when I used sudo. The easiest way to add this exception is to use the ‘visudo’ command as root.
Finally, I used Automator to wrap the whole thing up as an application I could add to my dock. It works! One less daily annoyance in my life!