Get DevWP - WordPress Development Theme
Local WordPress Development with MAMP for macOS
MAMP provides a local Apache, MySQL, and PHP stack for WordPress development on macOS. Configure PHP in your PATH, tune php.ini for local limits, and point your browser at localhost.

Local WordPress Development with MAMP for macOS

4 min read

MAMP gives you a complete Apache, MySQL, and PHP stack for local WordPress development on macOS. I’ve tried most of the alternatives — Valet, Herd, Docker — and keep coming back to MAMP because it’s the easiest to configure to match a production server.

Why MAMP for macOS?

When on Windows I use XAMPP for local WordPress Development, but on macOS, MAMP just works the way I like it.

This is part of a series on building custom WordPress themes with DevWP. Check out the companion videos:

Installation and Configuration

  1. Download MAMP from the official website.
  2. Run the installer and follow the installation wizard. Choose a suitable installation directory (e.g., /Applications/MAMP).
  3. Once the installation is complete, launch the MAMP application.
  4. Click “Start Servers” in the MAMP control panel to start Apache and MySQL. Click “Stop Servers” to shut them down.

Determining Your Shell Environment

macOS Catalina and later default to Zsh. Older versions use Bash. To confirm which shell you’re running and locate its config file:

# Check which shell you're running
echo $0

# Locate shell executables
which bash
which zsh

# Open your shell config file (use whichever applies)
open ~/.bash_profile
open ~/.zshrc

Adding PHP to Your Path

By default, macOS includes a system PHP that’s often outdated or missing entirely on newer versions. MAMP installs its own PHP, but CLI tools like composer, phpcs, and phpstan won’t find it unless you add it to your PATH. Open your ~/.bash_profile or ~/.zshrc and add MAMP’s PHP to the top:

# Add MAMP PHP to your path (replace version as needed)
export PATH=/Applications/MAMP/bin/php/php8.3.14/bin:$PATH

# Apply changes (use whichever shell config you edited)
source ~/.bash_profile
source ~/.zshrc

# Verify PHP version and location
php -v
which php

Replace php8.3.14 with the PHP version MAMP installed — check /Applications/MAMP/bin/php/ to see what’s there.

Fine-tuning the PHP Configuration

WordPress runs better locally with higher memory and upload limits than the php.ini defaults. The file is located at:

# Find your php.ini location
php --ini

# Or navigate directly (replace version)
# /Applications/MAMP/bin/php/php[version]/conf/php.ini

Open the php.ini file in your code editor and adjust the following settings:

memory_limit = 512M
max_execution_time = 300
max_input_time = 240
post_max_size = 64M
upload_max_filesize = 64M

Setting Up Document Root and URL

The document root is the directory where your WordPress installations live — MAMP defaults to /Applications/MAMP/htdocs. For example:

  • /Applications/MAMP/htdocs/wordpress
  • /Applications/MAMP/htdocs/dev

MAMP’s default URL is http://localhost:8888. However, you can change it to http://localhost by modifying the Apache port settings in the MAMP preferences.

For example, if you have a WordPress installation in /Applications/MAMP/htdocs/wordpress, you can access it by visiting http://localhost/wordpress in your web browser.

Common MAMP Issues and Fixes

Common MAMP issues and how to fix them:

  • Make sure you have the latest version of MAMP installed.
  • Check for port conflicts — Apache uses port 80 (or 8888) and MySQL uses port 3306. Run lsof -i :80 to see what’s listening.
  • Check the MAMP error logs located in /Applications/MAMP/logs for any specific error messages.
  • Verify that your firewall or antivirus software is not blocking MAMP.

MAMP FAQ

Do I need MAMP Pro?

No. The free version covers everything you need for WordPress theme and plugin development — Apache, MySQL, PHP, and a control panel. Pro adds per-site virtual hosts, dynamic DNS, and Nginx support, but none of that is required for local development. I used the free version for years before upgrading.

Can I run multiple WordPress sites at once?

Yes. Create a separate folder under /Applications/MAMP/htdocs/ for each site — htdocs/site1, htdocs/site2, etc. Each one gets its own database and its own WordPress install. Access them at http://localhost:8888/site1 and http://localhost:8888/site2.

What if Apache or MySQL won’t start?

Port conflicts are the most common cause. Another process (like the built-in macOS Apache) may already be using port 80 or 8888. Run lsof -i :8888 to check, or change MAMP’s ports in Preferences → Ports. For MySQL, check if another MySQL instance is running with lsof -i :3306.

With MAMP configured, you have a local environment that mirrors production. Install WordPress, point it at your htdocs subdirectory, and start building. For the rest of the dev environment setup, check out my guides on Git, Node.js, Composer, and VS Code.



View Our Themes