Any WordPress developer should have a local version of WordPress installed on their PC or Mac. Even if you are only a bit of a tinkerer, an offline environment is a much better place to do your work.
Why? Many reasons, including:
- It’s great for testing
- You can have as many installations as you like
- It is a lot faster
- You can experiment with design/functionality changes at no risk
- There is no danger of the site being inadvertently indexed by Google
I shudder to think of how much more difficult my work with WordPress would be if I always worked online. Fortunately, I have local WordPress installations that serve as virtual guinea pigs for everything that I do – from plugin and theme reviews, to coding experiments and design dabbling.
When it comes to installing a local version of WordPress on your Windows PC, we have you covered with this article. But what about faithful Mac users? Don’t worry – installing WordPress locally on a Mac is not a complicated procedure. And in this tutorial, I am going to take you through it step by step.
Featured Plugin - WordPress Facebook Plugin
1. Install MAMP
For the technically minded, MAMP is an application that creates and grants you access to local PHP and MySQL servers. For the rest of is, it provides all the relevant ingredients that enable WordPress to operate locally on your Mac.
You can download MAMP from the official website. Please note that you will be prompted to download both MAMP and MAMP Pro. You will not need the professional version of the application, and once you have installed the package, you are free to delete it from your applications folder. MAMP is the only application you will need to create local WordPress installations, and it is completely free.
The installation file is nearly 150mb, so it will take a few moments to download, depending upon the speed of your internet connection.
Once the download has completed, double click on the ZIP file, then double click on the file that appears subsequently:
Follow the installation instructions, and both MAMP and MAMP Pro will be installed on your system. You can find them in your applications folder.
At this stage, you can delete MAMP Pro (as you will not need it) by opening its application folder and running the “MAMP Pro Uninstaller” program:
2. Set Up MAMP
With MAMP installed, you can launch it via your applications folder, or your Launchpad. If you are a regular WordPress user, I recommend that you keep MAMP in your dock – you will be using it a lot.
When you first launch MAMP (and in subsequent uses), your Mac will prompt you for permission to allow MAMP to carry out certain processes:
You need to confirm your acceptance in order for MAMP to be able to do its job.
After a few seconds, MAMP should be up and running. A web page may automatically open – ignore it for now. First, we need to check and adjust a couple of settings.
Click on the Preferences button on MAMP’s main screen, then click on the Ports tab. Your Apache Port should be set to 8888, and your MySQL port should be set to 8889:
Then click onto the PHP tab and check that the latest version of PHP is selected.
Finally, click on the Apache tab and select a document root – this is where the files relating to your local websites will reside. I recommend that you create a standalone folder to hold your sites (e.g. “Local Sites” within your Documents folder).
That’s all the settings you need to work with in MAMP. At this point the Apache and MySQL servers should have been started – you can tell by checking the status on the main screen:
If the servers are green, you’re in business. If they’re red, you’ll need to click the “Start Servers” button.
3. Create a Database
When the Apache and MySQL servers started, a web page should have automatically popped up (as previously mentioned). If so, you should now go to that web page. If not, just click on the “Open start page” button.
Either way, you should see a reassuring confirmation of success:
Select the phpMyAdmin option from the navigation bar on the above page. For the uninitiated, phpMyAdmin is not a particularly fun place to be, but we only need to do one simple thing here.
First, click the Databases tab:
Please note that your screen may look different to mine, but you will have an equivalent option.
On the subsequent screen, you need to create a database. It can be handy to use a descriptive name, especially if you are planning on having multiple local installations:
You you click Create, you should see a confirmation message. Make a note of the name you gave the database.
4. Install WordPress
You can download the latest version of WordPress from the WordPress.org website.
It will download as a ZIP file, which you should unzip. Copy the unzipped folder (called “wordpress”) into the document root that you chose in step 2. I suggest that you also rename the folder to match your database’s name:
Now we need to visit your new local installation of WordPress. Doing so is much like visiting a normal website. To get to the root folder that you selected in step 2 (i.e. “Local Sites” in the above example), just type “http://localhost:8888″ into your browser’s address bar. You will then be presented with a list of subfolders contained within that root directory – which in my case, is just the one folder:
Click on the subfolder. At this point you will probably be prompted with an error message, stating that there is no wp-config.php file. Don’t worry – just click on the “Create a Configuration File” button:
You will then be presented with another page that tells you what information you will need in order to install WordPress. Don’t worry – we’ve got it all. Just click on “Let’s go!”
It is on the subsequent page that you must enter all of the vital details. Here is a list of what is required:
- Database Name: use the database name you created in phpMyAdmin (e.g. “test_site”)
- User Name: root
- Password: root
- Database Host: localhost
- Table Prefix: wp_
Once you have submitted this information, you will be taken to a new screen where you will need to click to run the install. At that point, you will be presented with another page where you can fill in a few basic details relating to the WordPress site itself, specifically:
- The name of your site
- Your user name
- Your password
- Your email address
- Search engine indexation option
Once you have finished filling in the required information, click install, and you are finished! You will now be able to login:
The website will behave like any other WordPress installation – you are free to do as you please.
You can bookmark any page as you would for any other website. Just remember – MAMP and the Apache/MySQL servers must be running in order for you to access the site.