Install WordPress on Mac with XAMPP
If you want to install WordPress on Mac OS X, you are always advocated using a local server environment setup tool, such as MAMP or XAMPP. In another guide, we have introduced the free web server package MAMP for Mac with steps to install WordPress on Mac OS X with MAMP. In this tutorial, we will review another free local development environment tool for Mac, XAMPP for Mac, and we will use this app to install WordPress on Mac so you can start developing websites locally, play or learn WordPress with a local WordPress installation without paying for a hosting account. You can build a WordPress site or blog locally on your computer, and transfer it to a real server when you are ready. It is a safe way to test WordPress before publishing online. If you are on Windows, do not forget to check out this guide: how to install WordPress on Windows PC?
How to Install WordPress on Mac?
To install WordPress on Mac with XAMPP is not difficult, there are several steps but just a couple tricky ones. Basically you need to download XAMPP for Mac, then install this software, after that go to download WordPress and install WordPress on Mac. Now let’s dive into the details, specifically by looking at some tricky steps.
Install XAMPP for Mac
Go to download the latest version of XAMPP for Mac from its official site here . At the time of writing, its latest version is 7.3.2. They are compatible with Mac OS X 10.6 or later. The main difference is the script or component versions, notably the PHP versions. However this does not affect our local WordPress installation. As everything with software, we recommend the more recent versions.
It’s a DMG file you will download. Double-click the file you just downloaded. Then install XAMPP on your Mac, drag the XAMPP folder to the Application folder to install it.
Launch XAMPP from the Launchpad on your Mac. Click the Start button in the General tab of the stack manager. Wait for the status icon to turn green.
Ensure that all services are running in the Services tab of the stack manager (or start them as needed). If you can’t start Apache on Mac, try to disable Web sharing from System Preferences… >> Internet & Wireless >> Sharing.
You can stop, start, restart or check the status of individual services from the Services tab of the stack manager any time you want.
Create WordPress Database in XAMPP
As we have mentioned above, local WordPress requires both PHP and MySQL. Now we need to set up a database for WordPress with XAMPP for Mac. XAMPP offers phpMyAdmin for us to manage databases. We can create MySQL database for our local WordPress installation on Mac with it. Before that, we need to enable localhost port forwarding in the Network tab.
Visit http://localhost:8080/ in Safari browser, click phpMyAdmin or directly access http://localhost:8080/phpmyadmin/ to open the web database management tool to create a database for your local WordPress site on Mac.
To create a MySQL database with phpMyAdmin on Mac, click Databases, choose & input the database name and click Create button, the MySQL database will be created and you can set up your local WordPress on Mac with it in following steps.
Now you have set up everything you need to get started developing and testing your local WordPress on Mac. Continue installing WordPress in just another couple of steps.
Download WordPress installer
Switch to the Volumes tab of the XAMPP stack manager on Mac. Click Mount button to mount the /opt/lampp directory. Then click the Explore button to open the XAMPP file manager in Finder.
Download WordPress from https://wordpress.org/download/ to the ‘htdocs’ sub-folder under the above XAMPP folder. Unzip the WordPress installer, you should get a ‘wordpress’ folder.
Create WordPress database connection
From the local WordPress folder, you should see a wp-config-sample.php file, duplicate this file first, then rename this file to wp-config.php and edit the connection to WordPress database from there. Remember that we have already created a MySQL database with phpMyAdmin above? Now we need to set up a connection between the WordPress files and its database, or we can say to link the Apache server and MySQL server.
Open this configuration file with a text edit, such as the TextEdit, on Mac, you will find a section of this php file like below image:
To create database connection for your local WordPress on Mac, you need to replace “database_name_here” with the database name which we have just created using phyMyAdmin, replace “username_here” with “root” and leave “password_here” blank.
Instead of using the default database user, you can also optionally, 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 WordPress installing from browser
Run Safari or any other browser you have on Mac, open this URL http://localhost:8080/wordpress/ to access your local WordPress. You will pull up the classic WordPress setup wizard. Fill up the basic information it requires, click Install WordPress button, your local WordPress on Mac will be created.
Another great alternative to XAMPP is MAMP which can also help you create WordPress sites on Mac OS X. Check out this guide: How to Install WordPress on Mac with MAMP?
Migrate Local WordPress to Web Hosting Server
If you have finished testing and experimenting on the WordPress theme, layout, plugins and widgets on a local WordPress blog on Mac, you may want to move it from local machine to a live WordPress hosting server. Here is some very good WordPress hosting service for your information. To migrate a local WordPress, you have to do it all by yourself, your web host may not be able to help as all the files, database and configurations are on your local machine. Check out this guide and see how to transfer WordPress to cPanel hosting.
Update Feb 2019: this article was originally published in Jul 2014 and has since been updated. we update instructions and screenshots above to reflect the changes in the XAMPP for Mac Version 7.3.2 on Mac 10.14 (Mac OS Mojave).