Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Installing WordPress Locally on Your Mac With MAMP

What is MAMP?

MAMP stands for Macintosh, Apache, MySQL, and PHP. MAMP is an application you can install on your Mac which allows you to have access to a local PHP server and MySQL server. Essentially, MAMP gives you all of the tools you need to run WordPress on your machine, for development and testing purposes. You can accomplish this in different ways, but the other ways aren't nearly as simple (see MacOS_X_Local_Mirror for the long, manual version of installing PHP and MySQL on your Mac).

Step 1: Installing MAMP

Before you can install MAMP on your Mac, you'll need to download it from the MAMP website. MAMP requires that your Mac be running Mac OS X 10.6.6 or later.

Once the MAMP download is complete, double-click the MAMP disk image (it should be something like MAMP_2.0.3.dmg), and you should get a MAMP window pop up. Drag the MAMP folder (not MAMP PRO - we'll save that walk-through for another time) to the Applications folder.

Step 2: Basic MAMP Settings

Now that you've got MAMP installed on your system, launch MAMP.app (located at /Applications/MAMP/MAMP.app).

While you're editing settings, MAMP might prompt you for an administrator password. This is required because MAMP needs to run two processes: mysqld (MySQL) and httpd (Apache), and depending on the settings you set for those processes, you may or may not need to input your password.

Once you open MAMP, click the Preferences button. Next, click over to "Ports." The default MAMP ports are 8888 for Apache, and 8889 for MySQL. If you use this configuration, you shouldn't get asked for your password, but you'd need to include the port number in the URL (localhost:8888). If you'd like to leave the port number out of the URL, change the Apache port to 80. The downside of using port 80 as your MAMP Apache port is that you'll always be asked for your password.

Lastly, on the Web Server tab, you'll need to set a document root. This is where all of your files are going to be for your local web server. An example of a document root is /Users/USERNAME/Sites/wordpress/.

Once you're done editing all of the settings, hit OK to save them.

Step 3: Starting MAMP Servers & Creating The Database

To start the MAMP Apache and MySQL servers, simply click "Start Servers" from the main MAMP screen. Your MAMP servers have now been started.

Once the MAMP servers start, the MAMP start page should open in your default web browser. If not, click on "Open start page" in the MAMP window. Once that's open, select phpMyAdmin from the webpage.

Under "Create new database", enter in a database name such as "wordpress", and press "Create." No need to choose an option for "collation"  : it will automatically be assigned by MySQL when the database tables are created, during the WordPress installation.

Step 4: Downloading and Installing WordPress

Now it's time to download WordPress. Once you've downloaded and unzipped the WordPress download, open up the "wordpress" folder. Click and drag all of the files from the wordpress folder to your MAMP document root (I use /Users/USERNAME/Sites/wordpress/).

Others with the default MAMP install should rename and drag the folder to the htdocs folder, located under /Applications/MAMP. Then in the browser, go to localhost:port/folder_renamed to run the install. For example, in the default MAMP install, if the folder was renamed wordpresstest, go to localhost:8888/wordpresstest.

Lastly, we've got to run WordPress' famous 5-minute installation. Visit your local site (localhost:port or localhost:port/wordpress), and enter the following information into the database setup form:

Database Name: wordpresstest
User Name (database): root
Password (database): root
Database Host/server: localhost
Table Prefix: wp_

Note that the default Database Name is "Wordpress" and that you will need to change the Database Name to the name you entered into PHP Admin (in this case, "wordpresstest"). If you have multiple WordPress sites on your local machine, each of which is using its own database, you will need to make the Database Name in the WordPress configuration consistent with your second (or third or fourth) Database Name.

Once that's complete, enter a blog name and email address, and you're ready to use WordPress on your Mac.