My blog has moved!

You should be automatically redirected. If not, visit
and update your bookmarks.

Sunday, January 2, 2011

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.


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
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

1 comment: