How to Install MAMP on OS X for Local WordPress Theme Development


Testing new WordPress themes, plugins, or upgrades before implementing it live on the Internet is a great way to streamline your workload as a web designer and developer. For example, if you want to create a new WordPress theme from scratch, it’s best that you develop the theme on your local server before you release it. Because once it goes online, who knows what can happen.

Quick Run Through

This tutorial requires that your computer is running Mac OS X. If you are on a Windows PC, read this article by Six Revisions on how you can install XAMPP on your computer.

  1. Download MAMP and WordPress.
  2. Install MAMP to the Applications folder.
  3. Extract the contents of the WordPress zip file and upload them to ‘/Applications/MAMP/htdocs/’
  4. Go to PhpMyAdmin and create a new database
  5. Edit the wp-config-sample.php file with the appropriate database information. Rename the file to wp-config.php
  6. Go to http://localhost:8888/ and you will be redirected to the WordPress install.php file. Follow the directions and fill in the required information.

Detailed Walkthrough

  1. Install MAMP and WordPress

  2. MAMP is an abbreviation for Mac+Apache+MySQL and PHP. These are the basic tools you need set up to be able to host a local web server on your computer.

    MAMP also comes with a Pro version, retailing at $50. One notable feature is the ability to run multiple websites locally with their own unique web address and folder structure.

    Your Mac also comes preinstalled with its own local web server called iWeb. Kudos to you if you already know this.

    You can download the latest version of WordPress here.

  3. Install MAMP into your Applications folder

  4. Once you finish downloading MAMP, install it to your Applications folder like any other program.

  5. Upload the contents of the WordPress folder to your development folder

  6. In this step, you can set up WordPress wherever you like. I put WordPress in my Dropbox folder so that the files are always backed up securely. By default, MAMP will look in your ‘/Applications/MAMP/htdocs/’ directory. If you decide to place WordPress elsewhere, make sure you make the appropriate changes in your MAMP preferences like I did below:

  7. Create a new database for WordPress in PhpMyAdmin

  8. WordPress needs a database to store its content and to be able to run properly. You can create a new database via PhpMyAdmin by going to http://localhost:8888/phpMyAdmin/. It should look like this:

    Create a database where it is indicated. You can name it whatever you like. I named mine “wordpress.”

  9. Edit wp-config-sample.php

  10. You will need to update your database information in the wp-config-sample.php file, which is found in your downloaded copy of WordPress. Locate this inside the file:

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'database_name_here');
    
    /** MySQL database username */
    define('DB_USER', 'username_here');
    
    /** MySQL database password */
    define('DB_PASSWORD', 'password_here');
    
    /** MySQL hostname */
    define('DB_HOST', 'localhost');
    

    Replace ‘database_name_here’ with the name of your database. Replace both ‘username_here’ and ‘password_here’ with ‘root’

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'wordpress');
    
    /** MySQL database username */
    define('DB_USER', 'root');
    
    /** MySQL database password */
    define('DB_PASSWORD', 'root');
    
    /** MySQL hostname */
    define('DB_HOST', 'localhost');
    

    Then, save the file and rename it wp-config.php.

    Alternatively, you can simply head to http://localhost:8888/, or its equivalent, and WordPress will help you setup the necessary configuration to have your website up and running.

    Setup Configuration File

    Click to expand

  11. Run the WordPress Installation


  12. Since Apache is found in port 8888, go to http://localhost:8888/ in your web browser. This will redirect you to the wp-install.php file located in your WordPress files. There, you’ll find the familiar instructions for you to install WordPress on your computer. Rejoice! The battle is essentially over!

  13. WordPress installed, MAMP running, now what?

  14. For starters, your local WordPress site needs some dummy content to work with. What? Did you expect to meticulously copy and paste some lorem epsum all day? Heck no! Go over to WPCandy and download their sample WordPress content here.

Don’t like reading? I understand.

If you merely skimmed this article and would rather see a live demo for yourself, check out this video on how to install MAMP on your computer. Cheers!

Image by Peter Armenti and Stéfan

Unlike XAMPP, MAMP has a far simpler interface, which makes it incredibly easy to use. Lend me your thoughts…do you use MAMP or something similar for WordPress development?

  • David K

    This is a great article thanks. But do you know how to enable MU on a local install as well?

  • Samantha

    Tony, thanks so much for the detailed instructions. I’m new to both the Mac platform and installing WordPress locally so your easy to follow instructions helped a lot!

  • Samantha

    Well, it was time to upgrade my desktop and I wanted an all-in-one to save some desk space. I’ve also become more interested in video editing (just home movie type stuff) and the native Mac apps really appealed to me. I ended up with the 27″ iMac and I’m loving it so far!

    Congratulations on your MacBook Pro!

    • http://loneplacebo.com/about Tony Hue

      Tell me about it! Mac apps are a godsend compared to Windows apps. You sometimes have to scratch your head wondering why you didn’t switch earlier.

  • Pingback: How to Run WordPress on Your Computer Locally with WAMP | intelliGines.com

  • Gines

    Tony, the good thing is we can complement each other. You’ll be one of my resources for Mac stuff.

    Thanks for this article. Made my life easier ;)

    Have a good one.

  • Tim

    Tony,

    Nice tutorial. But there is one thing missing… something that I would call the “Rosetta Stone” for WordPress/Mamp users. It’s this:

    How to replace the Mamp local database with an already existing live WordPress database?

    There is a lot of info out there, but nothing that I have yet found to fix this issue.

    Here is a link to a topic on the Mamp forums that describes in perfect detail the problem:

    http://forum.mamp.info/viewtopic.php?f=2&t=8969&p=19563&hilit=wordpress+wordpress+database#p19563

    If you know the answer, your help would be greatly appreciated.

    Cheers,

    Tim

    • http://loneplacebo.com/about Tony Hue

      Don’t you just import a backed-up database file to WordPress and change the database name in the wp-config.php file?

  • Tim

    You would think that’s the answer. However, when I do, I get the following error message:

    “Safari can’t open the page “http://localhost:8888/name-of-my-local-site/” because the server unexpectedly dropped the connection. This sometimes occurs when the server is busy. Wait for a few minutes, and then try again.”

    Obviously, “waiting a few minutes” does not solve the problem.

    I even have this in my config.php file to ensure it’s not an issue with the site url and home url:

    define(‘WP_HOME’,'http://example.com’);
    define(‘WP_SITEURL’,'http://example.com’);

    Try the process yourself and see if you get it to work… then let me know if it does!

    I’m running MAMP 1.7.1 on Mac Leopard OS 10.5.8

    Cheers,

    Tim

  • Annette

    I’m developing a client website with MAM/wordpress, and the installation worked beautifully. Now I have 2 more clients who want wordpress sites. How do I set up additional test sties on my mac? I’ve tried just repeating the mamp/wp install process, but I can’t find access to any of the sites when I do that. What’s the trick? I have scoured forums to no avail–surely this is not an unusual need…
    thanks. ak

  • http://casjam.com Brian

    I second this request – looking for information for how to manage MULTIPLE client WP sites locally.

    Different content, different set of plugins for each. Need an easy / efficient system for jumping between multiple projects locally.

  • DavidP

    @Brian,

    Did you find an answer to this? I am trying to do the same thing.

    dp

  • aaagneees

    hi. i tried so many times to install MAMP on Mac Os X version 10.5.8
    …APACHE WON’T RUN!!! for mysql there’s no problem, but i can connect to apache. please help me! i don’t find no way out!

  • Yenvious

    Great tutorial, thank you.

    Seems to me that its a bad idea to put an installation that deals with oftentimes tangled permissions within your Applications folder…

    I keep getting the error, “The uploaded file could not be moved to /Applications/MAMP/htdocs/…” etc.

    I would imagine that has to do with permissions and such…

    But other than that hiccup, I love it, so glad to be able to work on my sites from anywhere. Thanks!

  • Yenvious

    Fixed! If anyone comes upon it what worked for me was changing the permissions of the whole bundle to www (_www actually), with MAMP Pro.

  • http://www.creativebeacon.com James George

    I actually have an answer for you. Go into your sharing preferences section under system preferences and turn off web sharing. This makes Apache not run properly, I hope this helps!

  • BP

    Thank you for this tutorial. I remember trying to follow a tutorial for this a few years ago and went a little nuts. This time it was a snap. Thanks.

    • http://hacksocialmedia.com/ Tony

      Music to my eyes. I’m glad you found this useful.

  • Jhuynh08

    Hi,

    I’m trying to install and activate wordpress auction onto my mac but I’m not sure why it won’t let me open up or activate it. Any suggestions?

  • http://twitter.com/roelblogt Roel

    Thanks for all the helpful information. The strangest thing however, occurs. My local version won’t let me log in on admin or wp-login. No matter what I change the password and login to in phpmyadmin (admin/admin or admin/password or admin/empty) it won’t let me in. I even tried the original credentials of the live site. Neither did root/root work, I thought it might because that’s what I entered in STEP 5. What am I missing here?