Using MAMP to develop WordPress Themes, Plugins and sites on your Mac
Part 1 of 3: Installing MAMP
If you’re developing a new WordPress theme or plugin, or even if you just want to build your website before deploying on a hosted server, you can do so locally on your Mac. When WordPress is running on your computer and not hosted on the web, it’s quicker to make updates and your code stays entirely private until you’re ready to publish. This way you can even do development work before selecting a web host (which if you haven’t yet, check out the reviews to find the best WordPress hosts here.)
Of course, your Mac isn’t configured to run as a web server by default. WordPress requires a number of components which either aren’t normally on your Mac or else aren’t set up to run out of the box. This includes the Apache Web Server, the MySQL database, and the PHP language that is at the core of the WordPress code base.
While you can install and configure each of these on your own, there is a handy application that makes this whole process simple for you: MAMP, which stands for Mac, Apache, MySQL, and PHP. It gives you all the tools you need to run WordPress on your local computer for development and testing purposes.
This three-part article is a step-by-step guide to installing MAMP on your Mac (Part One, below) and configuring WordPress to run on your local machine (Part Two). It also covers the process of migrating from your Mac to your final Web Server online (Part Three), so that once you’ve completed the development and testing of your theme, plugin or website, you can deploy your work on the web and share it with everyone.
MAMP is a product of German developer appsolute GmbH and offered under the GNU General Public License as free software. It includes the above mentioned Apache, MySQL and PHP, as well as the Nginx Web Server and support for the Python and Perl languages.
In addition to the core free version, which should be sufficient for most WordPress development tasks, the “MAMP Pro” version is also available for a fee. The Pro tool allows you to run multiple servers if you have several sites to work on separately, and has a few other advanced configuration components that make development tasks easier, like Virtual Servers, Dynamic DNS and one-click installs of WordPress and other software.
As of this writing, MAMP 4.0 is available for free download at the MAMP.info website. It requires Mac OS X 10.10 (“Yosemite”) or newer. If you have an older Mac, you can also get version 3 of MAMP which works with OS X 10.6.6 (“Snow Leopard”) and up. You’ll need to look at the version history in the documentation section of MAMP.info to find the right version for your Mac OS.
Installing and Configuring MAMP
1. Download and Install
Download the appropriate version of MAMP from the MAMP.info website. Once the download is complete, double-click the MAMP “pkg” file (for version 4) and follow the installation steps. You may be required to enter your administrator password to complete the install.
2. Configure Basic MAMP Settings
Launch the MAMP app by going to the MAMP folder in your Applications folder at /Applications/MAMP/MAMP.app and clicking on the MAMP icon.
The application may ask for your administrator password to continue because it needs to run two processes: HTTPd (the Apache web server) and mysqld (the MySQL database). Depending on your settings for these processes, administrator access may be required.
Once you open MAMP, click on Preferences to access the core settings.
When accessing a site running on MAMP in your web browser, you’ll need to include the Apache port number in the URL you type in, for example, ‘localhost:8888’ would be the required browser location. This is because MAMP runs the Apache web server on port 8888 (and uses 8889 for MySQL) by default. You can view the default ports by clicking on the “Ports” tab.
Verify the default settings are as above. If you don’t want to have to enter the port number in the URL while developing and just use the address of “localhost” in your browser, then you will need to change the Apache port number in settings from the default of ‘8888’ to ’80’. The downside is you’ll always be asked for your password.
Next, click on the “Web Server” tab. You’ll want to be sure “Apache” is specified as the “Web Server”. Then specify the document root, the directory where all your files for your site will be stored. An example would be /Users/YOURUSERNAME/sites/wordpress – you’ll put the files in this directory when you install your WordPress application in the next part of our guide. You can leave the default and just note its location, but that will mean you have your documents stored in your Mac’s applications folder. To change this, click the folder icon to set a new location next to where it says “Document Root:”
3. Start MAMP
After verifying the ports and the root location, click “Start Servers” on the main MAMP screen to run Apache and MySQL. Your servers are now running.
Next: Installing WordPress using MAMP
In the next part of this series, we’ll discuss installing and configuring WordPress to run on the MAMP configuration you just completed.