Installing a content management system (CMS) such as WordPress on your computer gives you the freedom to test out site modifications or to build a site offline without paying any server hosting costs. It's also a great way to develop your own themes, templates or plugins in a speedy and forgiving environment!
But WordPress is designed to run in a MySQL database through an Apache server environment, so is it even possible to install in on an OS X machine?
In the steps below, I'll show you how to install WordPress on Mac by creating a local server environment and then adding WordPress to it.
- Step 1: Download and install the MAMP software package
- Step 2: Start a MAMP Apache server
- Step 3: Download the latest version of WordPress
- Step 4: Create a MySQL database for WordPress
- Step 5: Install WordPress through your browser
- Step 6: Access Your WordPress administration area
Step 1: Download and Install the MAMP Software Package
Let's start by getting that local software environment set up. To do that, we're going to use a software package called MAMP which stands for 'Macintosh, Apache, MySQL, and PHP'. If you are attempting to install WordPress on a Windows machine, you can just use the Windows variant, known as WAMP.
Download the MAMP software package installation files found on MAMP's website.
In your downloads folder, double click on the file named 'MAMP_MAMP_PRO_5.2.pkg' and complete the automated installation process. Everything is quite straightforward here, just accept the terms and conditions and keep clicking 'Continue'.
The installer will add a program called MAMP PRO in the directory /Applications/MAMP PRO as well as the standard MAMP package in /Applications/MAMP. You can simply ignore the PRO version, the free edition is perfectly capable of handling WordPress.
Step 2: Start a MAMP Apache Server
Once it's been installed, start the MAMP application. Remember to start MAMP, not MAMP PRO.
Before launching your new Apache server, it's worth changing a few of the default MAMP settings. In the MAMP screen that pops up, click 'Preferences...'.
In the settings window, select the 'Ports' tab. Change the 'Apache Port' field value to 80, and click 'OK'. This will allow you to access your WordPress site at a more convenient URL address.
If you want, you can also modify the location of your Apache files. By default, the installation folder is tucked away in /Applications/MAMP/htdocs/. However, in the 'Web Server' settings tab, you can select a more convenient location by clicking the 'Select' button next to 'Document root'.
When you're finished, return to the main MAMP window and click the 'Start Servers' button. Note, that in this main MAMP screen, the power symbol will turn green whenever your MAMP server is running.
If you managed to do everything correctly, MAMP will now open your browser and load a page with the address '/localhost/MAMP/?language=English'. This website is the root of your newly installed server and the page you see is running directly from your computer. Pretty cool!
Step 3: Download the Latest Version of WordPress
Now that you've got a server to run it on, it's time to get busy installing WordPress itself. Start by downloading a shiny new WordPress package from the WordPress download page.
Unzip the archive you just downloaded and copy the WordPress folder to the MAMP root location you set in the previous step. If you intend to install multiple instances of WordPress, you can rename the copied folder to whatever you like to make it easier to identify the version you're working on.
Step 4: Create a MySQL Database for WordPress
The next step on our path to local WordPress development on Mac is to create a MySQL database to install WordPress in. This can be done from the MAMP server page which MAMP opened for you automatically in step two. If you closed the page, you can access it again by navigating to '/localhost/MAMP/?language=English' in your browser.
When you've made it back to the MAMP server homepage, turn your attention to the top menu bar. Select 'Tools' and then click on 'phpMyAdmin'.
This will open phpMyAdmin which is a MySQL database management tool. Don't worry if you've never dealt with a database before, it's a very straightforward piece of kit to use.
In the phpMyAdmin window, click on the 'Databases' tab, enter a name for your database, and then click 'Create'.
phpMyAdmin will create your new database almost instantly. As soon as it's finished, you can exit the window.
Step 5: Install WordPress Through Your Browser
You're now ready to install WordPress itself. Finally!
To begin, navigate to 'localhost/WordPress' in your browser URL bar. Here you'll be presented with the WordPress installation wizard.
The first screen will ask you to select a WordPress language. Simply select the one you want to work in and then click 'Continue'.
You don't need to change anything on the following screen, so just click 'Let's Go'.
On the next page to appear, you'll need to link WordPress with the phpMyAdmin database you created. There are five fields to fill out. Input the following information:
- Database Name: Enter the name you gave the phpMyAdmin database.
- Username: root
- Password: root
- Database Host: localhost
- Table prefix: wp_
When you've filled out every field, click 'Submit'.
At this point, WordPress will sync up with your phpMyAdmin database. When this process is finished, you'll see a pop-up message telling you that it has been completed successfully. After that appears, you can hit 'Run the Installation' and wait while WordPress finishes installing.
In the final 'Information needed' screen, create your own WordPress login credentials and provide an email that you can use to reset your password if you forget it. Remember, your WordPress admin area won't be accessible except by users on your computer, so don't worry about creating a high-security password masterpiece.
After entering your new credentials, finish the installation process by clicking 'Install WordPress'. If all goes well, you should see another success message and a 'Log In' link.
Press it and enter your information to access your snazzy new WordPress dashboard, which should look like the screenshot below.
And that's it! Congratulations, you have successfully learned how to run WordPress locally on Mac!
Step 6: Access Your WordPress Administration Area
In the future, whenever you want to do WordPress development locally on Mac, all you need to do is open the MAMP application and click on the 'Start Servers' button.
When the power symbol has turned green, you can navigate to '/localhost/WordPress' in your web browser and log in to your admin area.
Move Your WordPress to a Live Server
Using WordPress on OS X is a great way to experiment with new WordPress plugins and test out site changes in a private and secure environment. It's also, arguably, the best way to learn how to use WordPress code as you'll experience virtually no lag when running complicated functions.
However, at a later date, you may wish to move your site to a publicly accessible server. If you want to do that, you won't need to replicate all of the things you've done on your Mac server manually. Instead, you should clone your WordPress site to transfer the changes in a single step.
But before cloning your site, you'll need a domain name and a web server. You can get hold of both of those by signing up to a WordPress-friendly web host. I recommend you check out my list of the best WordPress optimized web hosts to help you find the right one for you.
WordPress for Mac: Final Thoughts
An offline WordPress development environment is a great tool for WordPress developers or anyone wanting to experiment with WordPress. If you ever switch to a Windows machine, you can install WordPress locally on Windows by following this guide again. Just use the same steps but install the WAMP, rather than MAMP, software package.
I hope you found installing WordPress for Mac a simple and straightforward process. If you got stuck on any particular step, let me know by commenting below!