How to Install WordPress Locally on Your Mac with MAMP

There’s a popular saying among entrepreneurs that you should try to break things first, so that you can make them better. But if the thing we’re talking about is your WordPress site, then you’d better handle it with care, because messing around too much could bring the whole thing crashing down! Luckily, there’s a way to test changes to your site without having to worry about breaking it.
Our Sponsors
Build unbuildable WordPress websites
The best no-code Instagram feed plugin for WordPress
Automatic content aggregation & curation

There’s a popular saying among entrepreneurs that you should try to break things first, so that you can make them better. But if the thing we’re talking about is your WordPress site, then you’d better handle it with care, because messing around too much could bring the whole thing crashing down!

Luckily, there’s a way to test changes to your site without having to worry about breaking it.

By developing a site locally – which means offline, on your computer – you can simulate how certain changes, such as new plugins or design layouts, will work on the internet without actually having to upload anything to the real thing.

But there’s even more good news about making a local version of your site. You can also test and develop new stuff to your heart’s content entirely on your computer, far away from Google’s prying eyes, and indeed anyone else’s. Then, when you’re ready to unveil your creation to the world, you simply upload the changes made to your local version onto the servers where your live site is hosted.

Using MAMP to set up a local server

The key to building a WordPress site on a Mac is to install an application called MAMP that lets you mimic on your machine what goes on in the huge data centres that hold the servers where websites are hosted.

The great thing about MAMP is that it’s free, and really easy to use. We’ll walk you through every step in the process of installing it on your Mac, and then show you how to install WordPress too.

But first, what’s MAMP?

MAMP stands for Macintosh, Apache, MySQL, and PHP. These four are the main ingredients of your server stack, and together they give you all the tools you need to run a WordPress site on your computer.

Let’s take a closer look at the components of MAMP:

  • Macintosh: This is the operating system on a Mac desktop or notebook computer
  • Apache: An open-source web server that “hosts” the local copies of your websites
  • MySQL: The most commonly used relational database system in the world; every WordPress site uses it
  • PHP: A server-side languages which is also used by all WordPress sites

Okay, so why use MAMP?

MAMP is awesome for building new websites or testing new features on sites you already own.

The number one benefit of using MAMP is that it’s ridiculously easy to use. But there are also other things that it’s really good at:

  • Build and test your site on your computer, without affecting the actual, live site
  • MAMP is your personal sandbox – unleash your inner developer and experiment with projects and other sites without launching them on the World Wide Web
  • Developing sites locally is also more secure, since they’re more difficult to hack
  • Work and make changes offline; no internet connection needed
  • Use your local version as a backup copy

Installing MAMP on your Mac

The first you should do is download the latest free version of MAMP from the official website.

Your Mac needs to be running on OS X 10.6.6 or later in order for MAMP to work on your computer.

When it finishes downloading, double-click on the disk image and a window will pop up. Just drag the MAMP folder to the Applications folder and you’ve installed it on your system.

Activating and configuring local MAMP servers

Now access the Applications folder and click on the MAMP folder to view its contents. You can launch MAMP by clicking on the elephant icon.

It’s time to set some basic MAMP settings from the ports.

When you open MAMP, click on the Preferences button, then select the Ports tab. The default settings for MAMP ports are 8888 for Apache, and 8889 for MySQL. Basically, if you keep them that way it’s be fine: you won’t be asked for a password when running the server, however you’ll have to include the port number in the URL (i.e. typing localhost:8888 in the address bar of your web browser).

More experienced users however, might wish to change the Apache port from 8888 to 80. This makes it easier to access your local site copies since you won’t have to type in the port number every time, however you’ll be asked to input your password when you try to log in.

If you’re new to MAMP and developing sites locally, it’s highly recommend to simply stick to the default port numbers.

Click over the Web Server tab, and check that the Apache web server is selected.

The last thing you’ve got to do before launching the MAMP is setting a document root. This is the place where the web server can access all the files related to your web development projects.

The default document root is Macintosh HD > Applications > MAMP > htdocs. To change your document root, click on the grey folder icon and then choose a new location from the finder where your files will be stored.

We suggest you create a new folder called sites in your user directory, and keep all your web projects saved there instead. If you do this, then make sure that the address of default document root in MAMP is pointing to the folder you created, rather than the default location.

Hit OK to save your changes, and close the Preferences window.

Creating a new database

Okay, now it’s time to fire up your servers.

On the MAMP home screen, click on Open start page, and a new web browser window will pop up with a message telling you that MAMP has been successfully installed.

So far, so good, everything is working perfectly. But before we can get to building our new WordPress site, you’ll first have to create a database on which it will run.

On the MAMP start page in your internet browser, click on the phpMyAdmin link to enter the phpMyAdmin panel. This where we’re going to create a new database.

To do that, click on the Databases tab on the top navigation menu, and under Create database enter an easy name to remember such as example or wordpress. It’s always a good idea to name your database something that relates with the site that will run on it, so that you’ll always know which database connects with which website.

Click on the Create button, and a new database will be created. Awesome! Now, you’re ready to install WordPress.

Installing and setting up a WordPress site

Go grab a copy of the latest version of WordPress from their download page. Once the zipped file has finished downloading, unzip it and copy the folder (named wordpress) to the default document root folder (which is located at Applications/MAMP/htdocs by default).

To setup your new instance of a WordPress site, open your browser and go to localhost:8888/wordpress.

If you named the folder you downloaded from the WordPress site something else, make sure to type that name in the URL field instead. So if you named it example, then go to localhost:888/example.

Now here’s the fun part: WordPress’ Famous Five Minute Install.

In the first installation screen, choose your preferred language and click the Continue button.

In the next screen, you’ll be presented with some information that is required about your database. Click Let’s go! and input the follow details in the following screen:

  • Database Name: example
  • User Name: root
  • Password: root
  • Database: localhost
  • Table Prefix: wp_

Note that the default database name is wordpress, but you should change that to the name you gave your database in the phpMyAdmin console.

Click on the Submit button to finish the first part of the installation. Hit the Run the install button on the next screen.

You’ll now get to a screen asking for details about your site. Type in the site title, your username, password, and email address. There’s no need to check the Privacy box since your site won’t be online anyway.

Click on Install WordPress and eventually you’ll see a success screen, which means that you can now use WordPress on your Mac!

Click on the Log in button to enter you site. Type in your username and password, and – voilà – welcome to the WordPress dashboard for your brand new site.

You’re all done now, and you can start uploading content, installing plugins and themes, and do everything you can do on a live WordPress site. You can log in again to your dashboard any time on your browser by going to localhost:8888/example/wp-admin.

Whenever you want to create another local WordPress site, just follow the steps above again – except installing MAMP.

Each time you set up a new local site, you’ll have to create another MySQL database, with a name that correlates to the new project. You’ll have to download a fresh copy of WordPress, then rename and drag the unzipped folder to your default document root.

Time to start coding

If you never used MAMP to build WordPress sites locally before, then get ready to discover just how convenient it is being able to mess around with your web development projects on your Mac.

It’s basically “Practice Mode” for the internet! You can make as many mistakes as you want, build the most outrageous things, and if things really go south you just install a fresh copy.

And if you already have a live site, then you can rest safe in the knowledge that whatever crazy experiments you try on your machine, nothing bad will come out of them and ruin the experience for the users of your site.

So enjoy testing new ideas, plugins, and themes on your local site, and let us know if you found this step-by-step tutorial helpful. Let us know your thoughts in the comments below.

Mark Debono
Mark Debono
Mark is a copywriter and online marketing consultant, and founder of remote web marketing agency Systemato. He's been using WordPress for over 7 years, and became a great fan of the CMS within seconds of his first installation.

Consider sharing this post so others can find it:

Share on facebook
Share on twitter
Share on linkedin
Share on reddit
Share on telegram
Share on whatsapp
Share on pocket
Share on email

Join thousands of people receiving real-world, genuine evaluations of WordPress products and services just like this one every week.

Table of Contents

Leave a Reply

Your email address will not be published. Required fields are marked *

The Beginner’s Handbook
From an introduction on how WordPress works to our recommendations on products and services.

Join thousands of people receiving real-world, genuine evaluations of WordPress products and services

A single weekly email directly to your inbox.