Having a local staging environment available is essential for WordPress developers. MAMP is a popular solution, but some common issues can prevent the platform from running properly.
Fortunately, MAMP users have found fairly simple go-to solutions to these problems, which you can use to get your local stack up and working again. Often, all it takes is a few clicks.
In this article, we’ll review what MAMP is, why it’s useful, and how to find its error logs. Then we’ll walk you through five common resolutions to MAMP not starting. Let’s get right to it!
An Introduction to MAMP
MAMP is one of several popular local development platforms. It turns your computer into a server environment that can host websites while you work on them:
MAMP uses Apache, MySQL, and PHP, making it highly compatible with WordPress. There is a free version available, or you can pay for a proprietary version that includes installers and other features to help you get your first site set up quickly and improve your workflow.
Like all sites hosted locally, your MAMP development or test website will not be publicly available. This enables you to build or test features freely, without worrying about it affecting your front-facing User Experience (UX). It also prevents visitors from stumbling upon your half-completed site.
Plus, local development doesn’t require an internet connection, so you can work from anywhere. Local sites also tend to load faster, which may improve your productivity somewhat. Once you’re finished building or making changes to your site, you can migrate it to a live server.
We’ve covered how to install MAMP in a previous post. At this stage, we’ll assume that you’ve already been using it but have run into a problem.
How to Check Your MAMP Error Logs
Finding your MAMP error logs is quite simple. Just navigate to the folder where your installation is saved and open the logs folder. You should see files for your Apache, MySQL, and PHP error logs:
If you’re experiencing problems with MAMP not starting, this should be your first step. Check the logs to see if there are any messages related to the problem and whether they provide specific steps you can take to resolve it. This is much faster than trial and error troubleshooting.
What to Do If MAMP Is Not Starting (5 Top Solutions)
Some common issues MAMP users run into include Apache not starting and MySQL not starting. Either problem will keep the platform from running, making it impossible for you to access your local site. Here are some top solutions that should help you resolve both roadblocks, so you can get back to work.
1. Restore Your Document Root Folder
Your MAMP installation’s document root is where your virtual host’s HTML, PHP, and image files are stored. Suppose you have purposefully or accidentally changed or deleted your document root folder. In that case, you may see an error message reading “Apache couldn’t be started. Please check your MAMP installation and configuration” when you try to launch your server:
To fix this, you simply need to restore your document root folder or tell MAMP where you’ve moved it. This process varies depending on whether you’re using a Mac or Windows machine, in that the file paths might be slightly different. However, you should be able to follow the steps below on either Operating System (OS).
By default, the MAMP document root is located at Applications/MAMP/htdocs on macOS, or C:MAMPhtdocs on Windows. If you know where your new document root folder is, you can open your MAMP configuration file by navigating to Applications (or C:) > MAMP > conf > apache > httpd.conf, and then replacing the default path with the new one.
Once you open httpd.conf, search for mentions of “DocumentRoot” and replace the default path everywhere. Save the file, then stop and restart MAMP.
Alternatively, you can select your new document root via the MAMP control panel. Open the Preferences window and select the Web Server tab:
Make sure Apache is selected. Then, click on the Select button next to Document Root. This will open a Finder window, where you can choose the folder you want to use as the document root.
Click on Select once you’ve chosen the correct folder, then select OK in the MAMP Preferences window:
This will reset your document root and automatically restart MAMP. Apache should then be able to start.
2. Change Your Listening Port
By default, MAMP runs Apache on port 8888. If this port is in use by another application, Apache won’t be able to start.
To fix this problem, you can either quit the application preventing Apache from connecting to port 8888, or change the listening port in your MAMP configuration file.
If you want to discover which app is blocking the port, you can use the command line to do so. The command you need to enter will vary depending on your OS:
sudo lsof -nP -iTCP:$PORT | grep LISTEN
netstat -ab | more
These should return a list of Process Identifiers (PIDs) and the ports they’re running on. You can terminate the process that is running on the port you need in order to start MAMP by using one of the following:
sudo kill -9 <PID>
taskkill /F /PID pid_number
When performing the above commands, make sure to substitute placeholders such as
pid_number with the appropriate values.
If you want to change the listening port in your MAMP configuration file, you can do so by opening your httpd.conf file and changing all mentions of “port 8888” to “port 8000” (or another alternative). Save the file, then restart Apache.
Additionally, you can change the Apache port in Preferences > Ports:
Click on OK to save your changes.
Looking for a powerful tool for local WordPress development? DevKinsta features one-click site creation, built-in HTTPS, powerful email and database management tools, and more. Learn more about DevKinsta!
3. Kill All MySQL Processes and Restart MAMP
If your MAMP problems are due to MySQL rather than Apache, there are a few go-to fixes you can try. The issue is usually due to another MySQL service running on the same port.
The easiest solution is to kill all MySQL processes and restart MAMP. On macOS, you can do this using the Activity Monitor, which you’ll find in the Utilities folder on your computer.
Search for “mysqld”, select any processes that are running, and then quit them by clicking on the X button in the top-left corner of the window:
Windows users will need to open the Resource Monitor from the Start menu:
Search for the mysqld.exe file, right-click on it, and select End Process. Once you’ve quit all MySQL processes on your computer, stop and restart MAMP.
4. Clear Your MySQL Logs
If killing all the active MySQL processes on your computer doesn’t enable MySQL to start, you can try deleting your MySQL log files. These are stored in your MAMP db/mysql57 directory:
They should be named ib_logfile0, ib_logfile1, etc. Back up the log files, then delete them and restart MAMP. The log files will automatically regenerate when they’re needed again.
5. Delete the mysql.sock.lock File
MAMP must write Process Identifiers (PIDs) for active processes to a mysql.sock.lock file. If this task fails, the file is left behind instead of being deleted once the process completes.
This will prevent MySQL from starting up, as it treats an empty mysql.sock.lock file the same as one that contains a running PID. To fix this, you’ll need to delete the file manually.
Navigate to your MAMP files (Applications/MAMP on Mac or C:MAMP on Windows) and look for the tmp folder. Then select the mysql folder, search for the mysql.sock.lock file, and delete it. As with the log files, a new mysql.sock.lock file will automatically be created when it’s needed next.
MAMP is one of the local development solutions for many WordPress professionals and hobbyists (note: it’s not the only one). However, some issues may arise that will prevent your server from starting, and ultimately delay your workflow.
In this article, we walked you through five possible solutions if Apache or MySQL won’t start:
- Restore your document root folder.
- Change your listening port.
- Kill all MySQL processes and restart MAMP.
- Clear your MySQL logs.
- Delete the mysql.sock.lock file.
Save time, costs and maximize site performance with:
- Instant help from WordPress hosting experts, 24/7.
- Cloudflare Enterprise integration.
- Global audience reach with 34 data centers worldwide.
- Optimization with our built-in Application Performance Monitoring.