Install WordPress locally on a Mac

| May 23, 2012 | 36 Comments

Ever want to be able to play with WordPress and not worry about breaking your live site? Want to have an environment where you can try different things like plugins, themes, or that cool tutorial you found and want to work through? Well, then this is the post for you, (especially if you’re a Mac user). I’m going to walk you through installing WordPress on your Mac computer and working with it just as if it was a live production environment. (*Note: This is a “by request” post; I was asked to write about this by a few students in each of my Intro to WordPress classes. I’m going to do a couple of these, series-like–one for Mac users and one for Windows users.)

What you will need to get started:

  1. A computer running the Mac OSx
  2. A good amount of hard drive space (There isn’t a hard and  fast number here, but I would suggest something around 50-75 GB, especially if you are going to be working on multiple sites).
  3. A copy of MAMP, downloaded from this site

What is MAMP?

MAMP is a piece of software that gives you all the tools you need to run WordPress on your own machine for development and testing purposes. MAMP stands for Macintosh, Apache, MySQL and PHP. When it is installed, MAMP allows you to run a webserver locally on your machine with access to a MySQL server and PHP. While there are other ways of achieving the same result, like manually installing Apache, MySQl and PHP, this is easily the quickest and most efficient way to do it.

Setting up MAMP on your Mac

As stated previously, I think MAMP is the best solution for running WordPress (and websites in general) on your Mac. And while there is a paid, pro version available, the free one does everything you need it to do…and did I mention it is free?

So, the first thing you want to do is download the software from www.mamp.info. Then, locate the file you downloaded (it will be named something like MAMP_MAMP_PRO_2.05.dmg, depending on what version you downloaded), and install it like you would any other application for your Mac.

Just like that, you have MAMP installed on your computer, and you’re halfway to running your own development environment!

Now you can start MAMP up, (which you can do from Applications/MAMP, unless you’ve installed it somewhere else), and you’ll see two things. First up will be the awesome desktop widget (pictured below) that lets you start and stop the servers as well as launch the start page. You can also go through the settings found inside the Preferences button on the widget, but there really is no need to do this since MAMP works pretty smoothly right out of the box. The second thing you’ll see is the MAMP start page, but I’m getting to that in a second.

The MAMP Dashboard Widget

The MAMP Dashboard Widget

The next thing you’ll need to do is set up a MySQL database for your local WordPress install. On the MAMP start page, there is a link to PHP MyAdmin. You can get the start page to launch from the dashboard widget by clicking on the button cleverly labelled ”Open start page.” On the PHP My Admin page, you’ll find the tools you need to create a new database. The best part of this page is the ability to set up literally hundreds of databases if you need them. This is especially great if you are doing client work, because you can have a separate database for each client project, and, when the time comes to migrate the work from your local machine to their hosting provider, you can package everything up–database and all–and move it on over. Once you have the database all set up, it’s time to install WordPress!

Installing WordPress

If you have ever installed WordPress on a  hosting provider’s site, you know that FTPing the files can take a few minutes. One of the nice things about working locally is how quickly you can have a new WordPress install up and running.

Here is how I go about installing WordPress:

  1. Create a new folder in the htdocs directory of your MAMP installation. This is where your site will live.
  2. I keep a copy of  the latest version of WordPress unzipped and ready to go on my hard drive (I keep mine in the cleverly labeled folder called WP in my Documents folder). Simply copy and paste all of the files from the WordPress folder into the folder you created for your site.
  3. Open a browser of your liking and navigate to localhost:8888/yoursitename/wp-login.php and run through the (less than) 5 minute install.
  4. Once you’ve done that, presto!, you now have a fully functional WordPress install/site to work on at your leisure!

Hopefully, this takes the mystery out of installing WordPress locally on your Mac. I’ll do a walk through for Windows users in the next couple of days.

 

The following two tabs change content below.
When not at his day job in the hosting industry, Al teaches WordPress at a Toronto, Ont college and also does corporate WordPress training. As a freelance web developer, he is always busy building sites on the WordPress platform. All this leaves him very little time to ride his Harley and watch NFL football.

Latest posts by adavis (see all)

Tags:

Category: Build, Tutorials

  • http://www.zuba-marketing.com Valerie

    Hi Al,
    Could I run WP locally on an iPad and use it as a stand-alone kiosk at a tradeshow using a mobile template?
    Val

    • adavis3105

      Hi Valerie,
      I have seen it attempted once and it didn't go particularly smooth. I've never tried it myself but I imagine it could work with a bit of patience and a ninja like knowledge of the iPad. Any reason why you wouldn't just buy a cheap hosting package for a month? A $5 charge seems like a cheap price to pay for little to no frustration.

      • valeriecrozier

        Hi Al,
        Sometimes the internet connection can be unstable or an added expense some people don't want to pay if they don't have to. We thought it would be a good idea to have a "stand-alone" option…. or both.
        Val

  • gp

    Thanks for instructions, but when I try to go to local host inbrowser, it tells me I have to setup wp-config – I have no idea how to do this & am complete newbie. Can you advise what I should do if you have some time? would be appreciated.

  • Rick

    Hi,

    Thanks for the instructions. I’ve got all the way to the penultimate action: ‘Open a browser of your liking and navigate to localhost:8888/yoursitename/wp-login.php and run through the (less than) 5 minute install.’
    What exactly do I write in my address bar if the name of my site is ‘supermarketfree.com’?

    • http://wpteach.com AlDavis

      it all depends on what you named the folder for the site in MAMP. For example, if you named the folder “supermarketfree’ in the htdocs directory, you would go to localhost:8888/supermarketfree in the browser.

  • bruce

    I’m new to wordpress and it seems that wordpress have not been very good at the installation side of their software. I have been working for two days to try to get the software to work on my Mac. I’m a graphic design not a tech geek. I have tried to numerous suggestions out there to get started and they are all so technical that it is just ridiculous. No one can explain it clearly. Why doesn’t wordpress do something about a developing the software to download, the same as other software companies where you download click and it installs. Please help . Even in you explanation the guy below me has to ask another question because its not clear. I’m not criticizing you it wordpress that needs to be critcized.

  • d

    I, too, tried this and got the error message: there doesn’t seem to be a wp-config.php file”

    Would you mind clarifying this step.

    Also, you pretty much glossed over creating a MySQL database – could you elaborate a little on this step. – Are there a number of tables or columns or whatever that you need. the MySQL interface looks pretty complicated.

    Thank you.
    D

    • http://wpteach.com AlDavis

      There should be a button on that page that says “create a configuration file” Simply click on that button and enter the database info it asks for and then finish the install. As for the database itself, don’t worry about tables and columns, WP looks after all of that during the install.

  • willi

    i don’t get step 3. how can I enter ‘yoursitename’ if I haven’t created any yet. what is that name then?

    • http://wpteach.com AlDavis

      the site name is whatever you called the folder you put WordPress into in the htdocs directory

  • rg

    Hi Al, it seems that if you are going to provide a tutorial, you would want to answer questions that your blog readers are asking. There have been several important questions about the wp-config file and how to create a database. Isn’t the point of this to help people get their local wordpress environment setup? Then you answer an off-topic question about an iPad…but not the questions that pertain directly to your tutorial?? I am not trying to be rude, but it sure would be nice if you could help your readers that are looking for answers as they get stuck. I have the same questions that D, willi, bruce, and rick have. Can you please address the wp-config question?

    • http://wpteach.com AlDavis

      Done. Thanks for your comment!

  • rg

    oops…sorry, I noticed the iPad question was from a long time ago. My bad.

  • vijayta

    Very help full, Thanks a lot

  • Pingback: BDW @ Night: WordPress Intro - session 1 | hank is me

  • Pingback: WordPress: One Hour a Day – An Introduction | Frantz Media

  • Laurent DUBIN

    Hello !
    thank you it is very useful !
    I have to develop a website that is already almost done on internet. I try to have it with MAMP. How can I do to see the actual website (I have all the files of the ftp) and develop it localy ?
    thank you !

  • Simon Rebsdorf

    What is a ht docs directory?

    • http://wpteach.com AlDavis

      Hi Simon, htdocs is a directory found within MAMP on your hard drive after you finish the install. It is where you would set up the sites you want to build/work on locally.

      • Simon Rebsdorf

        Cheers! what a swift reply :-) I have now come to the Create configuration file. And apparently I need to know something about a database username and password, but I have never set up any such things yet…?

        • http://wpteach.com AlDavis

          you’ll need to set up a database and user in phpmyadmin, which is one of the components of MAMP..your hostname will be localhost if you have gone with the default install.

          • Simon Rebsorf

            Ok. that’s yet another new step I haven’t heard of before. But is this needed it I have already got a user name and passeword from my web host who are running my domain elevfortaellinger.dk?

          • Simon Rebsorf

            The info I have got form my web host is this:

            Host : xn--elevfortllinger-4lb.dk
            Login : xn--elevfortllinger-4lb.dk
            Password : **** (a secret password that I won’t share here :-)

            Is this what I should fill into the WP fields:

            Database Name
            User Name (Your MySQL username)
            Password (and your MySQL password)
            Database Host
            ??

          • Simon Rebsdorf

            This was the ftp-information that I got from my web host (?)

          • Simon Rebsdorf

            Please ignore this comment/question – I got through this. My urgent question is given below :-)

          • Simon Rebsdorf

            Ok. In the PhpMyAdmin I’ve created a user with a password and I have then ftp’ed my whole wp-directory to my web host public_html-directory. Then, in a Chrome browser, I have typed my domain URL and I got this WordPress-webpage asking for Database name (wordpress), User name (the one I just made myself as described above), Password (ditto), Database host (localhost ??? SHOULD I GET THUIS FROM MY WEB HOST, or is this my localhost-name, – which is localhost), and then some Table prefix (which is set to “wp_” – SHOULD I CHANGE THIS?).

            BUT – when I type in these things, I get an “Error establishing a database connection”. PLEASE HELP – I FEEL THAT I’m VERY CLOSE NOW!! :-) Cheers in advance

          • Simon Rebsdorf

            BY THE WAY: There doesn’t seem to be any wp-config.phpfile in the wordpress directory, that I downloaded from WordPress. There is only a file named wp-config-sample-php.

            So this file is what has been ftp’en to my web host’s public_html directory. Perhaps this is the problem… (?)

      • Simon Rebsdorf

        Sorry! I got it – now I need to fill in the info from the web host. Exciting :-)

  • Simon Rebsdorf

    Genereal question: Why do I need to download anything on my computer, when WordPress is all webbased – and in principle, all info could be redirected to my web host without introducing a third party (my computer) into the equation?

    • http://dolcedesign.com darcey1

      I’m curious about this as well. What’s the benefit of installing something locally on my Mac Air versus in a subdirectory on my host’s server (not the client’s host, mine) where I have tons more space?

      • http://dolcedesign.com darcey1

        Sorry, just found this via Google: MAMP means “not needing to be connected to the Internet in order to run PHP and
        MySQL or even to test a contact form. One of the most annoying parts of
        development, at least for me, is the constant cycle of edit, save,
        upload, refresh.” NOW I get it. “http://wp.smashingmagazine.com/2011/09/28/developing-wordpress-locally-with-mamp/

  • Pingback: WordPress: One Hour a Day – An Introduction | WordPress Mom

  • http://www.facebook.com/pixelsteam Taylor Moore

    Really fantastic!!! I got it to work!
    Question: Once you have completed your revisions locally, what is the best way to upload it to your remote server….whenever i do it says it does not have a database.

    • http://wpteach.com AlDavis

      Hey Taylor, I use BackUp Buddy to migrate sites from my local dev environment to the clients server…works like a charm!

  • John

    Hello Al
    I got as far as step 3 successfully. Then when you say to navigate to “local host etc” I cut and pasted that into my browser and got nowhere. Can you be more specific where to navigate to? I don’t have a site name and am not sure what a local host is. Thanks John