In this post, we will learn how to run WordPress locally on your Mac using MAMP. MAMP stands for Mac, Apache, MySQL, and PHP. It provides the full stack you need to quickly get your development site running locally so you can start working on your WordPress site.
To get started, download MAMP from the website. Then run the installer.
Select the default options when installing.
You can also install MAMP Pro and get a trial run. MAMP Pro has more features, though they are not necessary for our purposes.
Once MAMP is installed, start it. Start the servers by clicking “Start” at the top right.
Now note the directory in the “Document Root” box. This is where we will need to copy our WordPress files.
The default directory is
/Applications/MAMP/htdocs. You can unzip the WordPress files there or you can change it and unzip them to the new location. In this case, we will use the default.
Download the WordPress installation from the WordPress site and unzip the files in this document root directory. This is where you will do all your work. It’s a good idea to use git to manage your WordPress source code and keep track of revisions.
Now you’re ready to install a fresh copy of WordPress. The default MAMP port for Apache is 8888 and the default port for MySQL is 8889.
We will visit http://localhost:8888/ in the browser and start the installation.
On the next screen, enter the following settings. Note port 8889 for the database host. Also, use 127.0.0.1 instead of localhost as the address to avoid connecting through Unix sockets to an existing installation that is not part of MAMP.
Once WordPress is installed, you’ll see the confirmation.
Create an admin account for yourself.
And finally, you will be able to log in.
One you log in, you’ll be brought to the familiar WordPress admin screen.
Using MAMP on a Mac, you can quickly get a PHP, MySQL, and Apache stack going and install a new version of WordPress so you can start developing your site right away. You can even adapt this technique to run existing WordPress sites, but be careful as moving a site from one host to another can be tricky as there are URLs stored in the
wp_options table and possibly in other places in the database. In our case, we created a new database and a fresh WordPress install that’s ready to become the next production site. The next steps would be to use git to mange the site. In future installments, we’ll take a look at the necessary changes that need to be done to successfully move one WordPress installation from one host to another.