Installing WordPress on your Mac for Development

The Stack

To run WordPress locally you will need Apache, MySQL, and PHP installed. Although OS X comes with some of these it is more convenient to use MAMP. MAMP comes in a free version and a Pro version, for my purposes the free version should be fine.

Installation is just copying a folder from the disc image to your applications folder and removal is just a case of deleting the folder. Once the folder has been copied just start MAMP which will start the servers and open the home page on port 8888.MAMP

From the preferences > Apache pane set the document root to wherever you want to put your sites. I set mine to ~/dev/sites/.

The Database

Click on open start page on the MAMP dialogue then click on phpMyAdmin, enter a database name for your WordPress database then click on create. Click on privileges and create a new user with full privileges for the database.

WordPress

Create a subdirectory for your new web site in your sites directory, download WordPress from wordpress.org and unzip the contents of the download into the subdirectory.

Rename the file wp-config-sample.php to wp-config.php then edit it to fill in the database details and change the salts and keys.

Navigate to http://localhost:8888/ and you should see the subdirectory, click the link and you should get taken to the WordPress install page (if you get error connecting to database it is likely that either your database server is not running of there is an error in your wp_config.php). Fill in the blog title, username, password, and email, hit submit and you are done.

2 thoughts on “Installing WordPress on your Mac for Development

Leave a Reply