Installing WordPress on Mac OS X Tiger
Of the many options out there, many people choose to run their own blogging software as opposed to a managed service like Blogger or TypePad. On the software side, there are many decent tools available, such as Six Apart’s Movable Type (we have a tutorial for installing MT as well). WordPress is another mature, capable and free blogging engine that is very popular with many bloggers (like its founding developer, Matt Mullenweg) and rapidly gaining in popularity across the Web. WordPress is an excellent choice for a personal or professional blog, and the price is right, too. This tutorial will show you how to install WordPress 220.127.116.11 on OS X 10.4 Tiger.
Note: The most recent version of WordPress is 18.104.22.168, which contains a security patch among other improvements. This tutorial is fully compatible with the most recent version of WordPress. Version 22.214.171.124 is recommended for all WordPress users (upgrade instructions).
If you have installed another blog engine such as WordPress or Movable Type already, you may already have MySQL and/or PHP configured. If this is the case, you can skip right down to step 4.
Before we get started, let’s summarize what we’ll be going over in the installation:
- Downloading and Installing WordPress 126.96.36.199
- Enabling Personal Web Sharing
- Downloading and Installing MySQL
- Configuring MySQL
- Enabling and Testing PHP
- Configuring WordPress
If we’re going to blog our way to stardom, we’ll need some blogging software, right? The first step we’ll take will be to download the latest stable version of WordPress, version 188.8.131.52. The compressed file should be about 250KB, and OS X will decompress it for you.
Once it’s decompressed, we’ll move the
wordpress directory to OS X’s Web hosting directory in
/Library/WebServer/Documents. By default, all requests for the domain’s root directory (like
http://maczealots.com/) will go to this directory. This can be changed in Apache’s
httpd.conf file, which we’ll cover later. If you like, you can also change the name of the
wordpress directory to something else, like
blog. This way the URL of the blog would change to
http://www.yoursite.com/blog/ Additionally, if you want the blog itself to be at the root directory, delete all the items from the
/Library/WebServer/Documents directory and move the contents of the
wordpress directory to the now-empty
“Personal Web Sharing” (PWS) is Apple’s marketing name for Apache, the industrial-strength, tried-and-true Web server du jour. When you enable PWS, OS X starts up Apache, registers the modules, opens ports, etc. Since we’ll be serving the blog, we’ll need to have Apache running.
To enable Personal Web Sharing, open the Sharing preference pane in System Preferences. Check the box labeled “Personal Web Sharing”, and that’s it. (You may have to authenticate as an administrator before it will let you enable anything.) Go ahead and close System Preferences; you’re ready to install MySQL now.
Note: We are working on a version of this tutorial that includes the ability to host the database with SQLite, which is prepackaged in OS X 10.4. However, support for SQLite in WordPress is still being fully developed, so for now MySQL is still the way to go. If you’d like to see such an article, let us know.
MySQL is the database backend that WordPress (and other blogging packages like Movable Type) can use to store blog entries, users, comments, etc. MySQL is free for personal use. First, download MySQL (4.0.24 at the time of publication). It will come as disk image with two packages and a readme. We will be installing both packages. First, open the main MySQL installer. It will install all the necessary components to run MySQL onto your OS X volume. After that installer has completed, run the startup item installer, which will automatically start up MySQL after any computer restarts.
Note: One of the most common problems reported is that people install MySQL 4.1 instead of 4.0. I can understand the desire to be on the bleeding edge of software, but WordPress (and most other blog/CMS engines) use an older authentication scheme that is incompatible with MySQL 4.1 and greater. There are hacks and workarounds out there, but for the easiest installation, stick to MySQL 4.0.
Now that you have installed MySQL, let’s configure it so WordPress can access it. Open a new terminal session (found in /Applications/Utilities/Terminal.app) and type the following commands to navigate, make some changes, and start the MySQL daemon:
cd /usr/local/mysql sudo chown -R mysql data/ sudo echo sudo ./bin/mysqld_safe &
Next, let’s launch MySQL and use the test database (called
test, even) to make sure everything’s running correctly:
If everything’s running correctly, you should see output similar to this:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version 4.0.24-standard Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
Once you’ve verified that MySQL is running correctly, use the command
quit to return to the console prompt.
Now that MySQL is running, we’ll change the root password of MySQL so that WordPress (and you) can access it later. Use this command (where yourpasswordhere is replaced by your chosen password):
/usr/local/mysql/bin/mysqladmin -u root password yourpasswordhere
The last thing we’ll have to do in MySQL is to create a table for WordPress to store its data. We’ll call it
wordpress to keep things simple. To accomplish this, we’ll enter MySQL, create the table, and allow WordPress to edit it.
/usr/local/mysql/bin/mysql -u root -p CREATE DATABASE wordpress; quit
Now that MySQL is ready to go, let’s fire up PHP. OS X ships with PHP installed, but not activated. Fortunately, this is really easy to do. The only file we’ll need to edit is
httpd.conf, which Apache uses for its configuration.
Open the config file in your favorite editor (I’ll be using pico):
sudo pico /etc/httpd/httpd.conf
Mosey on down to the Dynamic Shared Object (DSO) Support section. It’s the one with all the
LoadModule listings. The one for PHP 4 is towards the bottom of that list. Look for the line and uncomment it to activate it. You can uncomment a line by removing the pound symbol (“#”) from the beginning of the line. The new line should look as such:
We’ll also need to uncomment the PHP 4 entry in the
AddModule listings, so that it looks as such:
Once those two lines are edited you can save the
httpd.conf file and quit the editor. Since we’ve edited Apache’s load setup, we need to restart Apache so it will recognize the changes:
sudo apachectl graceful
With that out of the way, let’s make sure that PHP is indeed running. Create a new text file in your favorite editor (stay away from RTF-happy TextEdit, though – SubEthaEdit gets my vote) and fill it with the following text:
<?php phpinfo(); ?>
Save the file as
test.php in the root directory (
/Library/WebServer/Documents/) and load the address of the page (usually http://localhost/test.php) into a Web browser. If PHP was correctly enabled, the
phpinfo(); command should output page after page about the PHP installation. If not, retrace your steps – it can be easy to make a mistake.
Now for the last step: configuring WordPress. First, you’ll need to edit WordPress’ default configuration file
wp-config-sample.php. You’ll find it in the root folder of the WordPress installation. This is where you’ll set up the database information. Edit the following settings:
define('DB_NAME', 'wordpress'); – Change ‘
wordpress‘ to the name of the database you created in MySQL (in the example we named it
define('DB_USER', 'username'); – change ‘
define('DB_PASSWORD', 'password'); – change ‘
password‘ to the MySQL password you chose.
Once you’ve made the changes, save the file as
wp-config.php in the same directory and delete
Now, open a Web browser window and start the WordPress installer, found at
http://localhost/blog/wp-admin/install.php. (Remember that if you chose to install WordPress in a different directory, such as the root directory, the address will be different for you.) WordPress will take you through the install process and set up the database with all the tables it needs to run.
After it completes, it will give you the login (admin) and password to log in to WordPress. The password is randomly generated and not recoverable so please write it down!
After you log in, there are two things you need to immediately do. First, change your password to something you can remember. You can find it in the Users tab of WordPress’ controls. Also, to avoid posting entries as “Administrator”, you can either create another account with a posting name, or simply enter a nicknaame in the admin account. But whatever you do, change the password and remember it — once you lose it, your data is hard to get back.
Now comes the moment you’ve been waiting for. Click View site » in WordPress’ controls or open a Web browser and go to
http://localhost/blog and watch your blog appear! Roll up your sleeves, perfect the CSS, and wax poetic, serving it to the free world without spending a dime on extra software. Happy blogging!