Recently we published an article about how to install WordPress on your Windows computer in 1 minutes using InstantWP. As this local WordPress installer does not come with a Mac OS X version, in this guide, we will show you how to install WordPress locally on Mac using MAMP. MAMP stands for Mac, Apache, MySQL and PHP. It is an easy to install and use local server software made to help PHP developers to build and test their website on local Mac before publishing to a live server or website. In this guide, we will show you how to install MAMP on Mac, install WordPress on Mac, then offer additional tips about WordPress hosting and how to move a WordPress site to remote server.
How to Install and Configure MAMP Server for Local WordPress on Mac?
Before you can install WordPress on Mac with MAMP, you need to download the MAMP from https://www.mamp.info/en/downloads/. This download package contains the free MAMP and a free 14-day trial of MAMP PRO. MAMP can be used stand-alone without MAMP PRO. Once the MAMP download is finished, double-click the MAMP disk image, drag the MAMP folder to the Applications folder, not the MAMP PRO. You can now launch MAMP from Applications » MAMP.
Note: If you can’t start Apache on Mac, try to disable Web sharing from System Preferences… >> Internet & Wireless >> Sharing. If you are on OS X Mountain Lion, you may need to turn off Apache before starting MAMP.
From the above main MAMP screen, you will need to make some basic configurations to set up the local server environment on which your WordPress can be installed and running with. Click the“Preferences” button you will get a new popup dialogue with options including: Start/stop, Ports, PHP and Apache.
Here you have the option to control when to start and stop local servers on your Mac computer. We suggest you to enable Start Servers when starting MAMP and Stop Servers when quitting MAMP. So each time you start MAMP, the local Apache server automatically starts on your Mac, when you close the MAMP app, you shut down the Apache server at the same time.
You can disable the check for Pro version and the start page option. The start page option can be set to your local WordPress directory, so when you start MAMP, you open your local WordPress on Mac at the same time. If you leave it to the default directory, the MAMP start page will provide you easy access to phpMyAdmin.
The default port number would be 8888 for Apache port, and 8889 for MySQL port. Usually you do not need to change them. If you like to custom the port numbers, make sure they are not taken by other apps on your Mac computer. If the ports are available, you can also set them to the default Apache and SQL ports on production WordPress hosting servers, they are 80 and 3306 respectively.
(note: if you leave the Apache port to the default 8888, then your local WordPress site can only be visited with URL http://localhost:8888/; on the contrary, if you change it to the default Apache port 80, you can directly visit http://localhost without the port number attached. A disadvantage of using port 80 is that you need to enter your admin password each time your start your local servers created by the MAMP tool.)
In terms of PHP version, WordPress minimum requirement is PHP 5.2.4 or greater. MAMP offers two different PHP versions. Technically both of them will work with your local WordPress installation on Mac. However we suggest you to choose PHP 5.3.5 which is also the default by MAMP.
This is the place to set, choose or change the document root directory of your local WordPress installation on Mac computer hard drive. You can click the Select… button to pick up the target local WordPress installation on Mac.
Create WordPress Database on Mac
WordPress requires PHP and MySQL to run. To create a local WordPress site on Mac, you will need to setup the PHP and MySQL for it. We have setup Apache and PHP in above steps. Let’s go to create the database for WordPress on your Mac now.
From the above main MAMP screen, click Open start page button, click on phpMyAdmin, you will be taken to a new screen where you are given the option to manage databases for your local WordPress site on Mac. You will be able to create MySQL database for WordPress with the phpMyAdmin tool.
Go to localhost, then select Databases, input a new database name in the Create database section, then click Create button, your first MySQL database for WordPress on local Mac OS X will be created!
In above steps, we have set up the Apache server environment on our local Mac computer, we have set up Apache, enabled PHP and then create MySQL database. It is time to start the local WordPress installing on Mac computer.
Install WordPress on Mac
You are now all set up to install WordPress locally on Mac. There are still a few steps to go. We are going to firstly download WordPress package, then create WordPress database connection and finally run WordPress installation from web browser to complete the local WordPress install on Mac.
Download WordPress to Local WordPress Root Directory
MAMP is a great tool to build local server on Mac with Apache MySQL and PHP support. However it does not built with WordPress, Joomla or any other CMS. To install WordPress site on Mac with MAMP, you will have to download the WordPress installer separately from its official website here http://wordpress.org/download/. Go to download the WP installer to the local WordPress root directory that we have set in the Apache Settings section above. It is your Applications/MAMP/htdocs folder, remember? Scroll up to the Apache setting if you forget the WordPress installation folder on Mac. Unzip all WordPress files from the compressed zip file, you will get a “WordPress” folder. Open it and drag all of the other contents into your Applications/MAMP/htdocs folder.
Create Database Connection for Local WordPress site
The PHP files work together with the backend MySQL database to run a WordPress site. We have the WordPress files in the root directory of the local WordPress installation on Mac hard drive, and we have created MySQL database for WordPress in phpMyAdmin, now we need to edit the WordPress configuration file to set up a connection between the local PHP Apache and the MySQL database on Mac. Find the file named wp-config-sample.php in local WordPress root folder, make a copy of it, rename it to wp-config.php. Open this configuration file with a text editor for Mac, such as TextEdit, TextWrangler.
Once the wp-config.php file opens up, replace “database_name_here” with the name of the MySQL database which was created in phpMyAdmin above; replace “username_here” and “password_here” with “root,” which is the default username and password in MAMP. Save the file.
Instead of using the default database user, you can also manually create a new user and add to database in phpMyAdmin. See this guide to create database and add user to database in phpMyAdmin. When you run into the database connection not established trouble, this could be the fix.
Complete Local WordPress Installation on Mac
This is the final step to setup our local WordPress site on Mac with MAMP. We need to run the WP web installer using a web browser. Open Safari on Mac, visit http://localhost:8888/. The WordPress installation screen displays as below.
Fill up the WordPress information such as site title, administrator username and password, your email address, click Install WordPress button at the bottom and you are done!
Move Local WordPress Site to Live Server Extra Tips
Another great alternative to MAMP is XAMPP which can also help you create WordPress sites on Mac OS X. Check out this guide: How to Install WordPress on Mac with XAMPP? If you want to transfer a local WordPress site from Mac to your web host, you can follow below steps.
1) Upload local WordPress files from Mac to FTP server with a FTP client.
2) created an empty MySQL database on the database sever
3) export local database from phpMyAdmin and import to the new database on server
4) edit the config.php file to point to new MySQL database on server
5) edit website URL in the new database with PHPMyAdmin or other DB management tools your hosting offers.