Install WordPress on Mac OS X

In this post, I’ll explain how to install WordPress locally on a Mac OS X machine.

First you’ll need to download the following:

XAMPP is an Apache distribution containing MySQL, PHP and Perl. It makes it much easier to install them. The Mac OS X package can be downloaded from here.

After downloading it, open the dmg archive and just drag the XAMPP folder to the Application folder to install it.

XAMPP will host our web folder and using the XAMPP console, we’ll be able to start/stop Apache HTTPd and MySQL.

First let’s start Apache HTTPd and MySQL:

Go to the Application folder, open the XAMPP folder and start “XAMPP Control”:

Now start both Apache and MySQL.
When starting Apache, you might be asked to authenticate. This will be required everytime you start or stop Apache.
If starting Apache fails, you’ll need to open the system preferences (Apple-Menu / System Preferences…) and choose Sharing (in Internet & Wireless) and disable Web sharing:

You should then be able to start the Apache web server.
If you get a message stating it wasn’t possible to start MySQL because it’s already running, you will need to either uninstall existing installations of MySQL or not have them start automatically. Here’s what I did on my system in order to do it:

ps -Af | grep sql | grep -v grep | awk '{ print $2; }' | xargs sudo kill -9

This will kill all running instances of MySQL.
Then I’ve edited /etc/hostconfig and removed the line MYSQLCOM=-YES-
Then the following:

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*

After that I was able to start MySQL from the XAMPP console.

WordPress

Open phpMyAdmin which is part of XAMPP: http://localhost/phpmyadmin
 

There you need to create a database in MySQL for WordPress using the following settings:

After clicking Create, the database you need for wordpress will be created.

Now you need to deploy WordPress in XAMPP:
Download WordPress from http://wordpress.org/latest.zip
Extract the file (double-click) and copy the wordpress directory to /Applications/XAMPP/htdocs:

Now you need to update the configuration of WordPress to connect to our MySQL database. Open /Applications/XAMPP/htdocs/wordpress/wp-config.php and make the following changes:

Now you just need to open the installation of WordPress by going to the following URL: http://localhost/wordpress/wp-admin/install.php

8 thoughts on “Install WordPress on Mac OS X

  1. Everything goes ok up until I am asked to open the wp-config file. There is only a wp-config-sample file in wordpress, and then I am unable to open that because my computer tells me that Dreamweaver cannot be opened due to it being a Power PC program. Did I need to have Dreamweaver previously installed on my computer? And will I get the same result if I work from the config-sample file instead of one just titled config?

    Thanks!

    1. No, you do not need Dreamweaver to open (not too sure why you have a Dreamweaver installed and why the Power PC version on an Intel machine…). You can open wp-config.php using any text editor. If you do not yet have the wp-config.php file, first rename wp-config-sample.php to wp-config.php. Then right click on it, go to Open With and select TextEdit.app.

  2. Hi,

    I need to install XAMPP and WordPress. However I already run apache and tomcat for other web development projects I am working on, Unfortunately uninstalling my current apache and tomcat environments is not an option.

    Would you happen to know if I will encounter issue with my current apache/tomcat environment by installing XAMPP? With my current project schedule I cannot afford any downtime.

    I am now running OSX, but I tried this once about 6 months ago under Windows 7 and my dev environment was hosed. I could not get either apache instances to run. It was a real mess.

    Thanks,
    Chris

    1. I have multiple Apache/MySQL setup installed in parallel (one with XAMPP, one with MAMP, one with AMPPS). Never had an issue.
      XAMPP and MAMP both come with all the software you need embedded. So you’re not overwriting anything.
      If you want to run your existing Apache web server and the one in XAMPP in parallel, you’ll have to set them up to use different ports.

Leave a Reply

Your email address will not be published. Required fields are marked *