26 Jan 2009

If MAMP or OS X crashes, it can leave MAMP in a locked state where, when you restart it, it shows Apache and MySQL as running when they really are not. Clicking the Start/Stop Servers button will have no effect.

The problem is that MAMP stores the process ID of the running servers in .pid files inside the MAMP application bundle. If it crashes, it can't always remove these files. When it restarts, it finds the .pid files and thinks that the servers are running at the process IDs contained therein.

The fix is simple: for Apache, delete the httpd.pid file in MAMP/Library/logs/ and for MySQL, delete the mysql.pid file in MAMP/tmp/mysql/.

If MySQL still refuses to start up, check that the process isn't still running.

If this is the case, your mysql_error_log file in MAMP/Logs may show you errors similar to:

InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.

Run: top and check to see if there is a mysqld process running. If there is, note its PID (e.g., 16320) and kill it:

kill -9 16320

Now, restart the servers in MAMP and everything should start working as before.

Creative Commons LicenseThe Resetting a locked MAMP article by Aral Balkan, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 2.0 UK: England License.

Add Your Comment

Spam Protection by WP-SpamFree

Resetting a locked MAMP

  1. or change the port, then change it back again. works everytime.

    Rolle
  2. Had this a few times too…
    But the solution is just as easy as go to “Settings…” then click on “OK” without even changing anything :)

    Melvyn
  3. Thanks Aral.
    I have been reinstalling MAMP after OSX crashes. This will definitely save me some time.

    Todd Rothe
  4. Indeed, changing the port will do the same thing. I ran into this problem a few times and just started to adjust all the settings. Changing the port worked for me.

    But finally I know what the real problem is! Thnx Aral!

    Frederik Jacques
  5. Awesome tip. Thanks for posting.

    Jason Campbell
  6. Thanks! I’ve been having this problem for a long time and never been able to fix it until today thanks to you!

    David Needham
    http://www.enjoycreativity.com

    David Needham
  7. Just as a FYI to help anyone else that happens across this post, I wrote a quick script based on this post to execute the deletion of those files in an instant. OS X regularly dies because my battery is zapped, so I was doing this a few times a week.

    Enjoy! http://tr.im/AVY8

    David Needham
    http://www.enjoycreativity.com

    David Needham