Install WordPress Locally on Your Computer for Testing, Development

One great app for local dev!

I’ve been asked a few times for a few pointers on how to work on your WordPress Theme and development area in a “safe” environment, away from a live server.

In other words, you’d rather work do your development in a place where only you can see it and if you’re going to make any mistakes it won’t completely hose or take down your server! In other words you’re going to install a “local server” instead of work on one that’s readily available and viewable by the entire world.

Obviously this is a good thing as you don’t want all of you dirty laundry hanging out for people to just snicker at, right? So then the answer is quite simple: Install WordPress locally on your own computer (laptop, desktop)! It’s not too hard and I’ll show you how to do it very quickly.

Ready to become a “Pro”? Here we go:

For Starters… Mac or Windows?

First thing you’ll need is one of the applications to use, including WordPress. There are many choices but I’ve found that these apps have seen the most success especially with people trying it for the first time:

  1. Windows – WAMP or XAMPP
  2. Mac – MAMP
  3. WordPress – You know where to go, right? Here!

Download one of those and I’ll begin to walk you through the Mac-version of the process (both Windows and Mac experiences are very similar). You’ll just set WordPress aside for now but we’ll get there very soon.

1. Download and Install:

I’m going to click that Gray Elephant icon above and grab the free version. Once you download it (might take a few since it’s 200+ MBs) you’ll walk through the installation process. It’s straight-forward:

Just go ahead and agree with the install and you should see it extract and begin the installation process:

For the Mac version I’m dragging in the left folder for installation. For Windows you’ll walk more through their auto-installer:

And that’s it. Once it’s done it might just want to restart you computer (if you’re on Windows) or just reboot for fun.

2. Setup App and WordPress

Once you restart go ahead and boot up the application. It should automatically kick you into a browser so you can see the native settings and configurations that come standard through the application.

Please also note that it should kick in a little notice or dialogue window that actively shows that your local MAMP server is online and working. You should see both of these green lights on:

This is how you can also Stop and Start your local server at will. I’m not going to spend any time explaining MySQL or Apache in this tutorial, you can Google those and read more about them but I’m sure you’re already familiar if you’re attempting this local install in the first place!

Back to your browser, the most important thing is this area right here:

You’ll need this information to install WordPress successfully so don’t ditch that quite yet.

If you don’t see this browser window just go here:

[cc]http://localhost:8888/MAMP/[/cc]

Installing WordPress is your next step! Just find the MAMP folder in your finder (it should be in your “Applications” folder) and drag and drop all of the contents of the WordPress application into the htdocs folder:

What it should look like is this when I’ve copied over all the WordPress files:

Looks a bit familiar? For those that have been around WordPress you’ll notice all the files that you’d come to expect. No surprise here.

The next part is simply installing WordPress: Just head back to your browser and head to this address:

[cc]http://localhost:8888/[/cc]

What you should see is the install screen:

Then you can walk through installing WordPress as you normally would. When you get to this screen just make sure you’re inputting the right information that MAMP (or your Windows app) is using natively.

As you can see I simply used the existing information that they provided me with:

  • Database Name: mysql
  • User Name: root
  • Password: root
  • Database Host: localhost
  • Table Prefix: wp_

And that’s it! You should see the success screen as you walk through your local settings:

Ah, the sweet feeling of success! You should also get an email too if you added a real email address:

So, to visit your new locally installed blog all you have to do is head back to this address in your browser:

[cc]http://localhost:8888/[/cc]

And there she is, a fresh install of WordPress:

3. Install WordPress Themes, Plugins

Obviously if you’re interested in doing this in the first place your aim is to do some local testing on a WordPress Theme or WordPress Plugin so that you don’t mess something royally on a live server.

If that’s the case then all you have to do is drag and drop any and all plugins and themes into the wp-content folder in your local system.

For example, I’m going to install a free WordPress Theme to work with (My own Content WordPress Theme) and one plugin (Simple RSS Reminder) to show you:

As you can see I’ve added those two folders into my htdocs folder under MAMP.

Now, when I login I should see them and be able to activate them on my local server:

And the plugin…

And when I check out my homepage and one of default posts I see not only the new WordPress Theme but also that the WordPress Plugin has activated successfully:

That was easy!

Now, you can go ahead and begin to do all your local work on your Theme, Plugins, and even create dummy content before you actually move it to a live server!

4. Migrating to a Live Server

An obvious next question is how to move it to a actual live server. This is an important step as you move from the local environment to the new one.

Now there are a lot of different and varying scenarios for the import process so I’ll keep it pretty generic here covering the obvious portions of the migration. For all other questions feel free to drop a comment below and I’ll see if I can help you!

The first thing you do is jump back into your MySQL database. You’ll have to head back to the browser and go to the URL of MAMP or your specific application. In my case it’s here:

[cc]http://localhost:8888/MAMP/[/cc]

You’ll see the link to phpMyAdmin which is the area where you manage your database. Click that link:

What you’ll now see is your actual database. What were going to do is export fully your WordPress database for use in the real and live environment.

Head over to the export tab:

The files that you want are specific to WordPress and if you kept the same prefix of wp_ then you’ll see them all here:

You’ll then want select the right ones here (or “All”):

And then you’ll want to save the file locally to your machine:

The file then should sit on your desktop!

Open up the file (should be named something like mysql.sql if you didn’t specify anything specifically) in a file editor.

I use Coda (among other FTP and Code Editors) and the next step is doing a Find and Replace on this query string for your New Site URL:

You’ll put search for:

[cc]http://localhost:8888[/cc]

and replace it with:

[cc]http://LIVESITEURL.com[/cc]

Then save the file.

You’ll then want to copy over the contents of the htdocs folder into your new server. Try to keep the same folder structure as you did on your local machine. For example, if you installed locally to /wordpress then your live server should have it installed on /wordpress as well.

Copy over all files and then edit your wp-config.php file to the new database that you’ll create via your control panel. I’d highly suggest not using the default values that you were using locally!

Then you’ll head to your own phpMyAdmin in your hosting solution and import the mysql.sql file that you exported earlier:

And then hit the import tab like you did when you exported:

Don't be too scared...

And that’s it!

With these changes you should be able to login to your new site that is live on a server and see what you’ve done locally!

Of course, the migration part as I mentioned previously is going to be a bit different depending on your settings and how you installed WordPress so feel free to ask questions.

For the most part though one of the better solutions than a full migration is simply working on the WordPress Themes and Plugins and just moving those files/folders instead of doing a full port every single time. This is much easier (obviously).

Migrate Live Site and Blog to Local Machine:

Have you ever wanted to try your hand at a new WordPress Theme, make the tweaks in a safe environment with real live data? Well that’s a good idea!

It’s quite easy to do: All you need to do is export your current and existing site via WordPress and then import into your local system. Go to Tools >> Explort >> All Content:

That was easy!

And then on your local WordPress installation you’ll just do Import >> Find File >> Next:

That was even easier!

After that you should see all of your live content in your local machine!

See, I tested it on my local box and have a full one-to-one (1:1) blog import:

You can see it in the above screenshot that I’m in my “local” environment by the fact that I have this in the browser url:

[cc]http://localhost:8888[/cc]

Done and done!

That’s it! Take a new WordPress Theme for a spin and try it on real, live data so that you know exactly what you’re getting into!

Good luck and happy developing!

  • http://www.carusophotography.com Jay

    Awesome. I still have a bookmark for the video you did on human3rror.com and provide it to people who ask about installing locally, but this offers more detail. Great post.

    • http://john.do John Saddington

      i decided to give it some more details via images… videos are fun but sometimes harder to follow.

  • http://ericdye.it Eric Dye

    HAWT!

    • http://john.do John Saddington

      you are!

  • Joe Chavez

    Jaw-dropping amazing. As soon as I upgrade my aging PowerBook G4, I’ll do this process and practice.

    Thanks John!

    • http://john.do John Saddington

      sure thing joe!

  • http://www.geekfori.com Matthew Snider

    MAMP user here – love it!

    • http://john.do John Saddington

      mamp is the uber!

  • http://suburbiauncovered.com/ Matt Powell

    Holy Cow! This is fantastic. I just downloaded MAMP last week and was trying to fiddle my way through it. I hit road block after road block. I’m ready to jump back in now and get my hands dirty again. Such great timing for me on this post!

    • http://john.do John Saddington

      awesome! tell others about it!

  • http://rocketplantstudio.com Brian Notess

    Solid post. This would have helped quite a bit when I was trying to figure this out.

    Seems like you could do a good follow up post on things like doing multiple WP sites locally, changing the location of your htdocs directory, etc.

    • http://john.do John Saddington

      … ah yes. fine… let me think about it!

  • http://www.warriorshepherd.com/blog Dave H

    This is super-amazingly awesome. Bookmarked.

    Thanks again John… this is going to be really handy.

    • http://john.do John Saddington

      sure thing dave!

      • http://www.warriorshepherd.com/blog Dave H

        Just created the local WP database… your tutorial worked like a charm. Keeping this bookmarked, though, to walk me through the migration and export.

        Thanks again.

        • http://john.do John Saddington

          sweet! this is what i love tohear!

          • http://www.warriorshepherd.com/blog Dave H

            Just completed the migration… I can’t believe I actually did it. (I hate SQL and php and all that jazz)

            Happy Customer. Check it out here: http://www.g42africa.org

  • http://getbusylivingblog.com Benny

    John,

    I know I was one of the people who asked you this question. So I’ve been waiting for the post! I always kept getting an error setting it up. For some reason the MySQL server light would always be red. I tried to troubleshoot but never could fix it.

    So I started to follow your instructions again. Re-downloaded MAMP. Rebooted my computer (this may have been the key). Ran the program and all lights are green!! I’m stoked!

    I’ll follow the rest of the steps later but wanted to say thanks for writing this post! Been waiting.

    • http://getbusylivingblog.com Benny

      Got WP installed! Nice!

      I don’t know if this is possible but is there a way to take my existing content, move it locally so when I’m testing new WP themes or customizing I could see how my new site would look with the existing content.

      Don’t know if it’s possible or too difficult but wanted to ask.

      This post rocked!!

      • http://john.do John Saddington

        not sure what you mean. use your existing blog content from a live site?

        • http://workingforwonka.com Kathy Ver Eecke

          I have the same question as Benny.

          I’ve been considering changing themes on my current blog, but am not sure about the process (will I lose stuff in the transition, if I don’t like it can I change it back with no hassles, etc.) Was thinking this local WP install might be the perfect solution to test the look of a new theme…but I would have to have a way to transfer over the content, images etc. from my existing blog. I think that’s what Benny is asking.

          • http://john.do John Saddington

            yes, that is quite easy. i will add this section in just a moment.

          • http://john.do John Saddington

            just added it! enjoy!

            • http://www.blankbook.co.za Coenraad

              John. Would this process also bring over the current theme files on the live site?

              I need to transfer a live site locally, in order to make some changes to the code, which is unwise to do on a live site. Then I would simply replace the changed files back to the live site, once it is done.

      • http://john.do John Saddington

        benny, i just updated this post at the end so you could test live content on your local machine. it’s quite simple!

        • http://getbusylivingblog.com Benny

          Hey John!

          Just saw you made the update! Awesome!

          I’m glad Kathy helped explain it better than I did.

          • http://john.do John Saddington

            sure thing benny!

    • http://john.do John Saddington

      thanks for spurring me on bro!

      • http://getbusylivingblog.com Benny

        You’re welcome!

        I exported and imported so easily! Thanks for sharing that. Seriously I looked for all this info for HOURS on the internet but no one had a good answer.

        • http://john.do John Saddington

          wow..! let others know about it!

  • Brandon

    Very cool ideas! I do have one question for ya…how do you change the color of the link text? Mine is black rightr now, but I want it probably blue or something more visible to the eye…?

    • http://KevinRossen.com Kevin Rossen

      You control that via CSS and how you do it specifically will depend on the theme you’re using. Many themes have a style.CSS file in their files, which can usually be found in the WP-Admin > Appereance > Edit area.

      • Brandon

        Thanks! I’m using Bueno theme by Woothemes…it’s very similar to standard theme, but not even close to how good standard is!

        • http://john.do John Saddington

          ;)

      • http://john.do John Saddington

        thanks kevin!

  • http://darrylbueckert.com Darryl Bueckert

    Wow. I am so ready for this post. How many more cards do you have up your sleeves?

    • http://john.do John Saddington

      … um. a few. i’m running out.

  • Adam

    Great tutorial. I wish I would have has this a couple of years ago. Well done.

    • http://john.do John Saddington

      sure thing adam!

  • http://jarederickson.com Jared erickson

    love me some MaMp in the morning.. only thing i do differently is install different folders in the root, so I can have multiple installs/tests going at the same time

    example:

    MAMP/htdocs/johnsblog
    MAMP/htdocs/tomsjellybean

    each folder would have a install fo WordPress or any other php/sql based thing i’m playing with

    • http://john.do John Saddington

      definitely.

      i assumed that this person was starting out. you’re a pro though…..

  • http://www.danieldecker.net Daniel Decker

    Pure Ninja. Thanks.

    • http://john.do John Saddington

      sure thing daniel!

  • http://suburbiauncovered.com/ Matt Powell

    I was able to get one site running very easily but going with more than one using these instructions is giving me issues. It seems to only want to use the file path of the first site/install.

    • http://john.do John Saddington

      see jared’s comment about about moving the install file to /file-name instead per install.

  • Ben

    I use this development environment with WordPress, and Love it! One twist I add: Move the htdocs folder location (I name mine simply “MAMP”) into my Dropbox folder, so I can keep my sites current among different machines (And backed up, too!). The only catch is you have to manually export/import the MySQL databases to keep content synced, but John covers that well in the post!

    • http://john.do John Saddington

      … wow ben, i LOVE that idea!

    • Demian Seiler

      Now that’s using the old grey matter right there. Great idea, I will have to give that a try.

      • http://john.do John Saddington

        seriously. smart move.

  • Roy C.Chukwu

    Hi,

    Thank you for this post. It is a very important reminder.

    I have been very busy for the last 6weeks now designing and redesigning my blog. If any thing happens, I will not be able to spend some time again.

    So by testing plugins, new vasions and so on my local system will make it possible for me reduce the risk of losing my blog.

    Thank you so much.
    Roy

    • http://john.do John Saddington

      sure thing roy! use it wisely!

      • Roy C.Chukwu

        One morething,

        How do I have move my blog from one folder to another. eg one of my blogs is on …/blog/ and I want to move it to the main folder.

        Also, add steps to change the domain name.

        Thank you,
        Roy!

  • http://www.lifeofasteward.com Loren Pinilis

    This is awesome. Thanks for making things simple for those of us who aren’t as tech savvy as we would like.

    • http://john.do John Saddington

      loren,

      sure thing! trying to elevate my community!

  • http://www.jeansandtie.com Jacob Bluhm

    I’ve been working with wordpress.com and considering a migration to .org. Do you have any advice on when and if this move should take place? I am slowly becoming addicted to your blog. Wish you had a better icon ready for my iphone, but I managed to crop the cartoon on the homepage for a nice direct link on my home screen. Good Days.

  • http://getbusylivingblog.com Benny

    Hey John,

    You wrote this

    “For the most part though one of the better solutions than a full migration is simply working on the WordPress Themes and Plugins and just moving those files/folders instead of doing a full port every single time. This is much easier (obviously).”

    I’m using a free theme but am working on the Standard Theme locally. When I’m done I just want to move the Standard theme to my hosting and use that.

    What files and folders would I need to move?

    So then that would mean that all the content would be intact on live site but that the new customized Standard Theme would be over it?

    When you talk about a full migration what’s the difference than just moving the theme file and folders?

    Thanks!

    • http://john.do John Saddington

      yes. just theme folders and files.

      • http://getbusylivingblog.com Benny

        Thanks John. Appreciate the answer. :)

        • http://john.do John Saddington

          did you manage to do it?

  • http://workingforwonka.com Kathy Ver Eecke

    Hi John:
    I finally switched to a mac, and was able to download MAMP easily and start tweaking my site locally. It was all fantastic! But today when I tried to jump back on the Mysql wouldn’t start. Apache starts fine. The ports appear to be set as 8888 Apache, and 8889 Mysql.

    Have you ever had this problem? Any suggestions?
    thanks
    Kathy

    • http://john.do John Saddington

      you might have to simply restart your computer… that happens.

      what mac do you have? version of OS?

      • http://workingforwonka.com Kathy Ver Eecke

        Jeez Luis John….that’s why I come to you. Restarted and viola. Working. Thank goodness, because I’m such a mac newbie, I can’t answer the ‘what version of OS?’ question.

        (It’s a macbook pro, new. So I would imagine it is whatever the latest version is….right?)

        • http://john.do John Saddington

          you can find the mac version here:

          http://cl.ly/8Nyc

  • anin

    Hey,

    if i have to work on 4 different websites (not subdomains, but completely different domains all together) do i need to install WP for each of them separately?

    So that each time i launch a new site, ive to install WP in HTDOCS, rename it as the new site’s name and then set about developing it?

    • http://john.do John Saddington

      you could… or you could use the multi-site functionality native to wordpress.

  • http://www.kyletroop.com Kyle Troop

    Thank you! This helped me out so much. I just took a job that I’ll be needing this for daily.

    See you at Plywood in August!

    • http://john.do John Saddington

      sweet! i prepared for it tonight!

  • http://www.bradblackman.com Brad Blackman

    Argh. I’m unable to properly import images and thumbnails. Everything else works, though.

    • http://john.do John Saddington

      import to local or production?

  • http://studio412design.com Nick Hempsey

    This is great John.

    I’ve been building “sandbox” sites on an extra Hostgator account I have set up. I was just thinking the other day it’d be great to not have to burn through so much bandwidth uploading and downloading to the server, just to check if this one little string is going to break everything or not.

    lol… good show. This is just what I was looking for.

    • http://john.do John Saddington

      for sure! save the time… it’s much faster on your local box.

  • Graham

    Would you know if either WAMP or XAMPP can after been set up on a pc then be transferred to and be run on a dvd
    i need to distribute a website gallery on dvd

    • http://john.do John Saddington

      man… i have no idea. have you tried?

  • DRG

    Nice info..!!! installing wordpress is now simple..!!!

    • http://john.do John Saddington

      sure thing!

  • http://www.robstill.com Rob Still

    Wow John, I followed your tutorial and did it! This is awesome, total game changer. THANK YOU!

    • http://john.do John Saddington

      you are so welcome!

  • http://campingeek.com Juzzy

    Really good tut!

    I knew there had to be a way to do this locally I also tried a hostgator sandbox and it all got too messy…. You came up in Google and delivered the goods! Bookmarked and thanks!

    Cheers,
    Justin.

    • http://john.do John Saddington

      awesome! so glad you’re here!

  • http://www.zeusnutrition.com yohann24

    Hi John,
    I’ve only just uncovered your gem of a site! Thank you for all your excellent posts.
    I followed your tutorial for installation but I am totally stumped at trying to migrate my site to a live server.
    Under “Export” tab none of the “wp_” files show up on the list?
    Any suggestions at what I’m doing wrong?
    Thank you for any insight you can give me.

    • http://john.do John Saddington

      hmm. that’s really odd…

  • Saji

    Hii John,I am new to blogging and have just installed wordpress using xampp on my window xp.Since it is installed localy on system the address and site url are showing localhost/wordpress.My quetions are 1>How can change the address i.e just want to remove localhost frm localhost/wordpress.2>Do I need a domain name and hosting service to do live bloging.

    • http://john.do John Saddington

      i have some posts about migrating to a live environment.

      • Erlend Johansen

        Hi John. Terrific blog :-) I´m having the same problem as yohann24. There are no “wp_” tables in phpMyadmin when I am trying to migrate my site to a live server. Not sure what I´ve done wrong here.

  • http://www.thinkcreatelive.com Sarah

    Thank you for this and all of your other posts!!

    • http://john.do John Saddington

      you’re welcome!

      • http://www.thinkcreatelive.com Sarah

        This has been working great for the last few weeks but then all of sudden nothing is showing up on the web page. Mamp shows it’s connecting fine to both servers but all I see is a blank page. Even when I view page source there’s nothing there. All of the files are still located in the htdocs folder. I didn’t consciously do anything to prompt this break. I’ve restarted multiple time and still see nothing. Do you have any ideas on how to fix this? Thank you for your time.

  • Sharon Fullen

    Found this post and really appreciate the details and thoroughness. I should be able to get this up and running quite fast thanks to your efforts.

  • http://WWW.alltopgadgets.com RAJEEV

    thanks dear, its working. but i face one problem on xampp

  • http://twitter.com/rpdtweet Richard Dickinson (@rpdtweet)

    Hi
    Nice article-shame it’s on MAMP -lol! :-) I’m Win7 PC user….
    As I am on Win7 I thought I’d mention Windows has x2 other WordPress installers for WordPress ie WebMatrix2 (7.5 Express) and WebPlatformInstaller (installs to IIS7.5).
    Also you can install WordPress manually in IIS after adding IIS via add/remove Windows features (then add WordPress directoy to inetpub>wwwroot).I just do not see the need for Xampp or Wamp (unless you want Apache server on Windows-which you may want!) on Windows!
    Happy web developing :-)

  • http://himanshunegi.in/about Himanshu Negi

    You have explained everything very well but still I am getting some errors – “Error establishing a database connection”.

    BTW your blog is awesome!

  • Amit

    Thanks a lot mate…..u really made installing wordpress locally a cakewalk…!!
    definitely coming back here and bookmarked this for future reference.

  • Chandra

    Great tutorial

    Thanks for posting

  • Peter Houston

    This has helped me no end… Thanks! One final hurdle to overcome if I can run it past you.

    I am trying to use this method to restore a site from an old local back up. I read somewhere that it was as simple as copying a backup WP-Content folder over the WP-Content folder generated on installation. This works to pick up the them, but not the content (posts or comments. Any thoughts?

    Peter

    • http://john.do/ John

      have to import the posts too via export tool.

  • http://www.theresathread.com Cari Kaufman

    Just wanted to say a big THANK YOU for writing exactly the post that I needed! This process worked beautifully for me. I can’t wait to try out some new themes on the local version of my site that I imported.

  • Lara

    Fantastic post, worked like a charm, and although I’m not one to look a gift horse in the mouth, it would be great if you’d also included how to upload images to the local host! I’m really stuck with that bit!

  • http://www.englishsmsquotes.com/ Angry Bird

    Exactly the post which i was searching…