How to Install WordPress (and Multisite) Locally on Mac/OS X With MAMP

Using WordPress in a local server environment is a must if you regularly test or develop themes and plugins.

Not only will your local sites run faster, but testing new features on your local machine will be safer than testing them on a live site.

Setting up WordPress locally isn’t difficult and will save you a lot of time if you’re constantly installing and uninstalling WordPress online.

In this tutorial I’ll walk you through how to set up MAMP on OS X, including installing MAMP, basic MAMP configuration, creating a MySQL database, and installing WordPress. I’ve included optional steps for setting up Multisite.

MAMP feature image
Set up MAMP and run WordPress locally on OS X.

What is MAMP?

MAMP, which stands for Macintosh, Apache, MySQL and PHP, is an application that allows you to install a local server environments on your Mac OS X computer.

WordPress isn’t a stand-alone application and needs server software to run. MAMP provides the necessary server setup so you can run WordPress on your computer rather than on the internet.

Installing MAMP

Head to the MAMP website and download MAMP. There’s also a premium version, but we’ll stick with the free version in this tutorial.

MAMP
The MAMP homepage.

The MAMP file is 245MB. Once downloaded, install MAMP like you would any other software for OS X.

Once installed, launch MAMP. The software may ask you about using MAMP PRO. Just ignore this and continue using the free version for now.

MAMP setup
The MAMP home screen is fairly minimal.

You will need to fix your MAMP settings before you can install WordPress.

1. Click on “Preferences”. Another window will pop up. Click on “Ports” and then click “Set Apache & MySQL ports to 80 & 3306.” These are the recommended ports, rather than using the defaults.

MAMP ports
Set the ports for Apache and MySQL

Next, click on the “Apache” tab and choose the location where you will install WordPress. The default location is Macintosh HD/Applications/MAMP/htdocs. This is similar to the public_html folder on your web hosting server.

I like to keep things organized, so I set my document root to Macintosh HD/Users/Rae/Documents/Test Site.

Apache document root
Set the document root for your WordPress install.

Creating a MySQL Database for WordPress

Before you install WordPress, you will need a database. MAMP ships with phpMyAdmin so we’ll use that to create a new database.

1. Open MAMP and click on “Start Servers.” You may be prompted to enter your computer’s username and password.

2. In your browser (Chrome or Safari or whatever you use), enter http://localhost/phpmyadmin/. The phpMyAdmin interface will appear. Click on “Databases.”

phpMyAdmin
Create a new database in phpMyAdmin

3. In the text area under “Create database” enter a name for your database and click “Create.” I’ve called my database “WP”. You don’t need to worry about any other options so you can close phpMyAdmin.

Download and Set Up WordPress

Download the latest version of WordPress. Extract the files to the document root folder you selected earlier. In my case, I’ll unpack all my WordPress files to Macintosh HD/Users/Rae/Documents/Test Site.

Unpack files
Unpack your WordPress files into your document root folder.

Open wp-config-sample.php and rename it wp-config.php. Open the file and scroll down until you see the following lines:

wp-config database details
Update your wp-config.php file with your database details.

These lines of code define the login details for your database. Replace “database_name_here” with the name of your database, which in my case is “WP.”

Replace “username_here” and “password_here” with “root,” which is the default username and password.

Save the file.

In your browser, go to http://localhost. You should see the welcome screen for the famous five minute WordPress installation process.

Famous five minute install
Set up WordPress using the famous five minute install process.

Enter your details and click “Install WordPress.”

Your WordPress installation is now complete!

Setting up WordPress Multisite

Having Multisite setup on a local machine provides not only a way to test themes and plugins in a Multisite environment, but also a quick and easy way to have multiple sites running at once.

Open your wp-config.php file again and add/edit the following lines to activate Multisite’s installation mode:

Activate Multisite
Activate Multisite installation mode.

Open MAMP and ensure your servers are running.

Login to your localhost site and under “Tools” you will now have a new option, “Network Setup.”

Network setup
Enabling Multisite will add a new “Network Setup” sub-menu item to WordPress.

Enter a name for your network and your email address, then click “Install.”

WordPress will prompt you to edit your wp-config.php and .htaccess files.

Following the onscreen instructions, open wp-config.php and add the following lines underneath your previous edit:

Multsite wp-config
Edit your wp-config file to get Multisite up and running.

Next, open .htaccess. If you can’t find it, make sure hidden files are displaying on your computer.

Your .htaccess file should look like this:

htaccess
Edit your .htaccess file to complete your multisite installation.

Multisite should now be enabled and working on your WordPress site!

Multisite network
Your Multisite network should now be up and running!

Summing Up

MAMP provides an easy way to run a local server environment on your OS X machine, allowing you to test and develop locally, rather than installing WordPress online. It will also save you time since you won’t have to install and uninstall WordPress each time you test themes and plugins.

MAMP is free, but there’s also a premium version that makes it even easier to set up databases and other options so you can use WordPress on your local machine.

Tomorrow, I’ll walk through how to set up DesktopServer on OS X for WordPress localhost development. And not to forget Windows, I’ll look at WAMP this week as well.

Do you use MAMP? Tell us in the comments below.

Comments (16)

  1. Another excellent article, Rae.

    I used MAMP way before I knew about WordPress and it is an incredible program to run PHP files and have the power of phpmyadmin at my fingertips. Once I knew about WordPress, it was easy to set up local test servers for WordPress.

  2. Hi Raelene,

    I’d be very interested in hearing the Windows version of this.

    I started using XAMPP in the new year and to be honest have had lots of problems with it, losing my work twice. In actual fact I have just uninstalled everything and about to do a fresh install. So far it has cost me time rather than saving time!

    The main problem it seemed was corruption in MySQL and it not being able to start.

    I’d be interested in hearing other solutions if they exist.

    Maybe one day I will have to bite the bullet and convert over to Mac, I just have so much software on windows.

    Best,
    Mike

    • Hi Mike! I’m a Mac user so I don’t tend to use a lot of Windows software, however I’m posting about XAMPP later in the week.

      You might like to try DesktopServer for Windows. I’m posting about it today for OS X and I was really impressed with it.

  3. Hi Raelene. I found this really clear and easy to follow – but I’ve done something wrong! When I paste http://localhost into my browser I get a blank screen. Have you heard of this happening before? Any clues as to where I’m going wrong? (All the wp files are in the nominated folder – I checked!)
    G

Participate