USING MAMP TO DEVELOP WORDPRESS THEMES, PLUGINS AND SITES ON YOUR MAC
Part 2 of 3: Installing WordPress
Once you have installed MAMP on your local machine, as described in Part One of this series, you’ll want to prepare your system, download WordPress, configure it, and optionally customize your theme. This article walks through all the steps of that process. At the end, you’ll have WordPress running on your Mac.
To start with you’ll want to download the WordPress software components and have them ready to install. WordPress is available for free at the WordPress.org website in the downloads area. We recommend grabbing the latest version if you can, but if your web host runs an older version you might experience compatibility issues because you’ll be developing in a different version than you’ll be deploying in. So, you’ll want to first locate the version number that your hosted WordPress site is using. Then, on the WordPress downloads page, go to the Release Archive, and download the matching version. If your host is running a very old version, you may want to choose a new hosting service provider. We have some recommendations here.
Once you locate the correct version, download the software to your Mac, and save the zipped file to a location that you like; by default, this is your Mac’s “Downloads” folder. Then you’ll need to unzip the archive by double-clicking on it. This will extract the contents into a folder in your finder right next to where you downloaded the zip file, also named “wordpress.” Later, you can delete both the original zip and this folder if you want, but just keep them where they are for now.
With all the components handy on your local computer, you can now start the process of installing WordPress and running the server via MAMP.
1. Launch MAMP and Start your Server
In Part One we walked you through installing MAMP, which should now be in your Mac’s Applications folder. Go to that folder and, in the MAMP folder, double click the MAMP icon. You’ll see the main MAMP screen, which includes the option to “Start Servers.” Click on this button to launch your servers.
2. Run phpMyAdmin
Once you have the servers running, you’ll need to continue the setup process using a web browser. Usually, when you click “Start Servers” the MAMP app will open the MAMP “WebStart page” for you in your computer’s default web browser. If not, click the “Open WebStart page” button in the MAMP app.
The first time you get to the WebStart page, you’ll see a success message, indicating MAMP was properly installed. On this page, you’ll see a number of options. Right now, select the Tools menu and then the phpMyAdmin option; this takes you to the dashboard to manage the MySQL database.
3. Create a New Database in MySQL
In the phpMyAdmin settings, you’ll see a menu on the left side; click on “New” at the top of the list. You can also click the Databases tab.
You’ll see an area that says “Create Database” at the top. Enter a name for the database such as “myexampledb” and keep a note of it. You do not have to select an option in the “collation” menu – this will be done automatically by MySQL during the WordPress set up later. If you plan on having multiple sites running on your local, you’ll want to give each database a unique name to make tracking easy.
Click “Create” to have phpMyAdmin make the database for you. You should see a database with the name you entered in the left-hand menu after the process (“myexampledb” in our case), and a message that there are no tables found in the database. This is okay, the tables will be created during the WordPress installation process. You can close these browser windows now if you want.
4. Place WordPress Files MAMP Document Root
In a finder window or tab, open the MAMP Document Root folder, which you set in Part One; it should be something like /Users/YOURUSERNAME/sites/wordpress/ – you can check the location by going to the MAMP app and clicking Preferences, then clicking the “Web Server” tab. Note that you’ll be placing the extracted WordPress code into the folder called “wordpress” inside another folder, which you should give a unique name that matches your site (more on this below.)
If it is not where you want, then click the folder icon to change it. You can use the default MAMP location, but this means your files will be stored in your Mac’s “Applications” folder, which some users may not prefer. Regardless, be sure to note the name of the root folder, as you will need it to access the WordPress install in your web browser. In our example, the name of the folder is “wordpress” but if you are using the default MAMP settings, then “htdocs” would be the folder name. You may want to rename this folder.
Then, also using your Mac’s finder, go to the WordPress folder you unarchived earlier, probably in the same location you downloaded the WordPress zip into. Open this extracted WordPress folder, which when unzipped is by default also called “wordpress”.
You should rename it to something relevant to your site. We’re renaming it “mytestsite” here. If you plan on developing many sites on your local, it’s a good idea to have an easy to remember pattern where this site name relates to your database names. Select this renamed folder from wherever it was extracted and then move it into your Document Root folder, which in our example was called “wordpress”.
5. Edit Config.php
To finalize the process, you need to set the config.php file that WordPress needs with the settings you created for the database.
We renamed our extracted WordPress folder “mytestsite” and dragged it into the MAMP Document Root. Inside this folder, you will find a file called “wp-config-sample.php” which is used to configure WordPress. You will need to rename this file to “wp-config.php” – that is, remove the “-sample” part.
Then open the file with a text editor and browse to the line where it says “MySQL Settings” and make the following changes:
Where it says ‘database_name_here’ change the text between the single quotes to the name of the database you created in phpMyAdmin – in our case, we would make sure it says ‘myexampledb’ – retaining the single quotes.
You need to change ‘username_here’ and also ‘password_here’ to both say ‘root’ – this will give WordPress the needed access to your database. Here’s what it might look like in a text editor:
Save the file and exit your text editor.
6. Install WordPress
You’ll now use the famous 5-Minute WordPress install process. In your web browser, enter the Apache Port number (default is 8888 but you may have set it to 80 in part one) and the name of the “/wordpress” folder you placed into your MAMP Document Root folder, in our example “mytestsite,” but it could be whatever you set in part one or in step 4 above.
You’ll enter the location in your web browser URL bar as “localhost:port/folder” so in our example using the default Apache port 8888 and “mytestsite,” it would be: localhost:8888/mytestsite
If you did everything right, you will see a WordPress “W” logo and the option to select a language, like so:
Select your language and click continue to the five-minute install process.
7. Basic Settings
In the Welcome screen, WordPress will need some information, such as the Site Title, a username and password, email address and a setting for Search Engine Visibility. On the internet, you’ll almost always want Search Engine Visibility to be enabled (unchecked), but since you’re using a local machine, the Search Engine Visibility doesn’t matter much, so you can just leave it unchecked. This will reduce the chance of an oversight later when you do publish to the web. The settings panel looks like this:
You’ll get a success message, then be taken to the login screen to enter the username and password you just created. After login, you’ll be at the WordPress Admin dashboard:
Congratulations: your WordPress app is now up and running. You can click “View your site” to confirm what a public facing page would look like using the current default settings.
8. Setting Your Theme
Once you have your install running, you can set up your WordPress environment with the same features you’ll have when you put it online. For example, you can install the Theme you want.
You may already have a Theme in use at a WordPress site online, and probably have some customizations in place. You can manually transfer the files, and update your settings to match. There are some tools that automate this, allowing you to quickly import and export Themes and settings. Two you may want to consider are WP-clone-template and Customizer Export/Import.
If you don’t yet have a Theme you can download a free one from the WordPress.org Theme gallery, or buy a premium one from a site like ThemeForest or Mojo Themes. For our example, we’ve downloaded the Activello theme from WordPress.org, which is one of the ones we featured in our article about Flat Design.
Regardless of if you are using an exporter or downloading a new Theme, you’ll want to extract the zip file and move that folder into the “Themes” folder of your current WordPress Directory Root. In our example, this would be /Users/YOURUSERNAME/sites/mytestsite/wp-content/themes – the place the extracted folder here using the default name it created when you unzipped it. We unzipped the Activello archive and put the folder with the same name there:
With MAMP running and the servers started, go to your browser and log in to your WordPress Admin panel, which in our example is localhost:8888/mytestsite/wp-admin – and enter your username and password. Then click on Appearance > Themes in the left-hand menu:
This will take you to the Themes options of your WordPress Admin, you should see the theme you just added to your /wp-content/themes/ folder. Hover over the Theme preview and then click “Activate” to use this theme:
9. Regular Use of WordPress on MAMP
To use WordPress on your local machine, MAMP must be running and the servers must be started. To login to your WordPress dashboard, all you need to do is to type ‘localhost’ into your browser URL bar, then the port number, and then the name of the site you selected, followed by ‘/wp-admin’. In our example, this would be localhost:8888/mytestsite/wp-admin/ which will show the login prompt when loaded.
10. Using Additional WordPress Installs
To add a new site, you’ll need to follow the above process again:
- Create a new database with a unique name
- Add another folder for the new site in your Document Root
- Copy the WordPress code into that folder again
- Edit config.php
- Do the 5-Minute Install
- Set a new theme
Next: Deploying to a WordPress Host
Once you’ve finished core development work on your local machine, you’ll want to deploy your code to your WordPress Host online. Part Three of this series will cover that process.