August 25th, 2008
MAMP is a great tool for running and managing a development server when you require more than the basic PHP configuration included with Leopard. However, getting the web server to run typically involves launching MAMP, entering your root password, and quitting MAMP.
This tutorial walks through the simple steps needed to launch MAMP silently on startup so that you do not have to enter your root password every time.
The issue with MAMP is that launching Apache must be done as root, so there’s no way to simply add MAMP to your startup items via the system’s Accounts Preferences in a way that will launch the app silently. But you don’t need to. Here’s the deal: MAMP’s launcher is just a pretty UI that opens a shell script that, in turn, launches MAMP’s Apache and MySQL servers.
You can set up launch daemons that do the exact same thing without the need to launch MAMP or enter a password.
Step 1: Create the Start-up Items
Open up your favorite text editor and paste the following into an empty document:
Create another for the MySQL start-up item:
Be sure to replace “YOUR_USERNAME” with the username for your account.
Step 2: Save the Files
Save this file as (or move the file to) /Library/LaunchDaemons/info.mamp.start.apache.plist and /Library/LaunchDaemons/info.mamp.start.mysql.plist, respectively.
Step 3: Set Permissions
If you try to launch the daemons at the moment, you’ll get a “dubious permissions” error. To correct this problem, you’ll need to change your permissions.
In your terminal, type:
You’re done! Reboot your computer and test that your development server is running as expected by opening a served page in your browser.