Setup WordPress Locally On Mac OS X

12 Comments

When designing WordPress themes, it’s nice to be able to store them locally to test them instead of uploading files to a web server (though Transmit makes it quite easy). In this tutorial, you’ll learn how to set up WordPress locally on your Mac and then manage multiple blogs with their own themes.

Note: A shinier, updated version of this tutorial can be found here.

The first thing you’ll need to do is make sure you have MAMP installed and running on your Mac. If you don’t, follow this tutorial first, and come back here when you’re done.

Next, you’ll need to have the latest version of WordPress.

After MAMP is up and running, drop that latest version of WordPress into the folder that your sites are stored in. For example, the htdocs folder in the MAMP Applications folder (default), or the folder you specified, such as Users/Username/Sites.

Next, we need to create a database so we can run WordPress. Open up the MAMP Startup page (there is a button on the control panel window), and go to phpMyAdmin.

In the MySQL column, there is a table for creating a new database.

After your database is created, open up the ‘wp-config-sample.php’ file in the root WordPress folder. Change the database name to ‘wordpress’ (or whatever you called your database). Both the username and password are ‘root’, and the host is localhost.

define('DB_NAME', 'wordpress'); // The name of the database
define('DB_USER', 'root'); // Your MySQL username
define('DB_PASSWORD', 'root'); // ...and password
define('DB_HOST', 'localhost');

Save this file as a new file with the name wp-config.php.

To install WordPress, open up wp-admin/install.php. From there, it’s the standard, simple WordPress installation.

Once installation is finished, you can view your blog at http://localhost:8888/WordPress/. Of course, the Dashboard is located at wp-admin/.

If you want to run multiple blogs with their own themes, all you have to do is repeat this process, and give each database a new name. You can use the same database if you like – some people prefer to have certain sample posts to test things.

12 thoughts on “Setup WordPress Locally On Mac OS X

  1. It’s always fun to test the latest WP nightly build locally, and SVN also works on OS X! Here’s a quick little tutorial on how to do that:

    * Open up the Terminal (Apps -> Utilities -> Terminal).
    * Then you’ll want to navigate the terminal to the directory WP is installed in. Here’s how. Let’s say you want your WP install to be in /Users/YourUserName/Sites/WP/ … you’d type:

    cd ~/Sites/WP

    Then, you’ll need to install the latest ‘bleeding-edge’ version, using SVN:

    svn co http://svn.automattic.com/wordpress/trunk/

    The terminal will list lots of files (WP files), as the terminal is pulling all of the WP files to your system.

    From there on, just navigate to that folder using localhost:8888/WP (your local address, and folder WP is in), and install it as described above! To update WP from there on (it’s updated daily), type:

    svn update

    … once you are in the terminal, and have navigated to the WP directory using the CD command.

    You might also want to refer to this article on the WP Codex on how to use SVN.

    I hope this helps!

  2. Great link and article. I’ve been meaning to setup something like this on my machine for ages, but have procrastinated like crazy. MAMP made it so ridiculously easy, though. I was up and running WordPress and all my other applications within 5 minutes.

    *waves goodbye to frivolous ftp access*

  3. I installed mamp and am running one test blog perfectly, and it’s off and live on the server. Now someone else has asked me to maintain their blog, and I’d like to have a copy of that one running locally as well. Can you break down how you add a new blog? In this text:
    If you want to run multiple blogs with their own themes, all you have to do is repeat this process, and give each database a new name. You can use the same database if you like – some people prefer to have certain sample posts to test things.
    I’m not sure what I have to repeat. Do I need a separate wp install for each blog? Sorry for being dense, Wendy (mamp rocks)

  4. Pingback: The Ultimate Guide to Building a Wordpress Plugin - NETTUTS

  5. Pingback: Cotton Rohrscheib - Blog Archive » Building a Wordpress Plugin

  6. hi there,
    thanks for the awesome tutorial! i wasn’t able to use the MAMP tutorial link however. maybe outdated?
    thanks again,
    jenn

  7. It was already pointed out to you in February 2010 that your “follow this tutorial” link is broken. Clearly, you couldn’t care less.

Comments are closed.