There are many benefits to running WordPress locally during development, one of which is that you do not have to wait for your Internet connection to load your content. In fact, you don’t even have to be connected to the internet, and you can work on your WordPress themes and plugins regardless of your location or connectivity.
The purpose of this tutorial is to show you how to get up and running with WordPress and how to have it configured with MAMP so that you can work blissfully away on your latest WordPress projects. Note that this tutorial does not just apply to WordPress — you can also install other services that would otherwise require a server or database to run (for example, MovableType or Joomla).
Part One: Getting and Installing MAMP
1. Firstly, you need to download and install MAMP on your machine. You can do this on Windows or Mac but for this tutorial we’ll be using OS X. Go to the MAMP website and download the latest version of MAMP Free. Note that there’s a paid version of MAMP also available — for this tutorial, and most of your development projects, you won’t even need to think about purchasing MAMP Pro, but if the feature list looks useful to you, go ahead and buy it.
2. Once you’ve downloaded MAMP, open the DMG file and drag the MAMP folder (make sure it’s the free version) to your Applications folder on your hard drive.
3. Once you’ve got MAMP on your computer, you can run the application and start your local servers. If everything’s gone correctly, both the Apache and MySQL server lights should be green.
Part Two: Configuring MAMP and WordPress
1. If you haven’t already, open up the MAMP application and press the Preferences… button. The next part is entirely personal preference but I find it best to have ‘Start servers when starting MAMP’ checked and the other three checked boxes unchecked. Now, go to the Apache tab, by default, it’s linked to htdocs, a folder located within MAMP’s folder in our Application folder.
I link to to a folder called Sites that’s located in my home directory — the purpose of this folder is to point MAMP in the direction of where you’re storing your local site data. On OS X, this folder should already exist, and you can set the document root to:
(or browse to it using the ‘Select…’ button). Press OK. If this folder doesn’t exist for some reason, you can create it.
2. It’s time to create your website and its directory, but first you need to go to the WordPress site and download a copy.
3. Once you’ve downloaded the latest version of WordPress, extract the ZIP file you downloaded and go to the Sites folder you created earlier (or wherever your document root is). Create a new folder — this will be the name of your website and it is best if you don’t include any spaces within the name. For this tutorial, we’ll call it LocalPress.
4. Copy the entire contents of the WordPress folder you downloaded and extracted earlier into your LocalPress folder.
5. Now we need to go back to MAMP and set up a database for WordPress to use. Hop over back to the MAMP application and click ‘Open start page’ – this page is essentially a portal to the apps bundled with MAMP and is where we’ll setup our database.
6. Once you’ve opened the start page, click on the phpMyAdmin tab along the top of the webpage and where it says “MySQL localhost”, type a name for your new database. Again, in this example, I’ll call it ‘localpress’ — keep all the settings default and press ‘Create’. Well done, you’ve successfully created a database and you’re now ready to set up WordPress! You can now leave the start page.
Part Three: Configuring WordPress with MAMP
1. Now, we have everything ready to go, we have our database set up and our document root correctly configured. In your browser, with MAMP and MAMP’s servers running, go to http://localhost:8888 in your browser. This is the root of MAMP and is relative to your document root. You should see a list of your sites contained within the document root, click on the name of your site and you’ll be taken to WordPress’ famously quick and easy installation process.
2. Depending on your machine, the first page you see once you’ve clicked the name of your local website will be a page that tells you that a configuration file needs to be created. If you see this, click the “Create a Configuration File” and then you’ll be ready to go.
3. Once you’re all in standing order, you’ll see a welcome page, read through it and get accustomed to WordPress and click “Let’s go!”. You’ll be taken to the main setup page.
4. On this page you now need to enter all the information about the database we created earlier. In the first field, enter the name of the database we created. In our case the database name is ‘localpress’, the second field is the username and by default this is ‘root’ — ‘root’ is also the password. The final two fields (Database Host and Table Prefix) should be kept default. Click the ‘Submit’ button and if all of your information is correct, you’ll be taken to the page that starts the installation. On this page click on ‘Run the install’ and WordPress will be installed locally on your machine.
5. If everything has gone according to plan then WordPress is installed and all you have to do is enter the final details about your blog. You can give your blog a name and create a user, and for local installations it really doesn’t matter if the final box is checked or not.
6. Once you’ve entered all of your information, click ‘Install WordPress’ and then you’ll be guided to a confirmation page. Click the ‘Log In’ button and enter the credentials of the information you entered a moment ago.
7. When you’ve logged in, you’ll be taken to your blog’s dashboard which is installed locally! Now, if you go to http://localhost:8888/localpress you’ll be able to view your site.
You have successfully downloaded and installed WordPress on your machine as well as installed and configured MAMP to provide a server and database. Now you’re free to develop and design without the need for an Internet connection and you can test themes before you release them online.
Earth movers photo from Shutterstock.