Installing WordPress 2.6.1 on Mac OS X Leopard
WordPress is supposed to be so easy to install, that this guide is not necessary at all – so why bother?
Sure, an initial setup doesn’t take more than 15 minutes to complete, no problem. However, if you configure your Permalinks to look more SEO-friendly (like, http://yoursite.com/blog/2008/08/20/my-posting/ instead of the default http://yoursite.com/?p=123) your WordPress setup could fail you.
First, you need to follow the WordPress install instructions on Mac OS X – these are written for OS X Tiger, but they work just as well for Leopard. However, there are a few minor details to consider when you’re at STEP 3 – Activate PHP in Apache Web Server:
You need to activate PHP in the Apache Web Server. If you’re comfortable with vi, edit the Apache config using the following command:
$ sudo vi /etc/apache2/httpd.conf
If you’re not comfortable with vi, edit the Apache config with TextEdit:
$ sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/apache2/httpd.conf
The terminal prompts you for a password. Enter the password you use when you install or update your software.
Now your editor is open, search for the following line:
#LoadModule php5_module libexec/apache2/libphp5.so
Remove the leading # from the line and save the changes.
Moving WordPress to a subdirectory of the document root
The main reason you would want to move WordPress to a subdirectory of the Apache document root is to prepare room for additional content next to your WordPress blog. The reasen you would want to do it now is that you want to use Permalinks which are still pointing to the same, valid URL years from now.
So, here are the instructions to move your blog to the /blog subdirectory:
- Create the folder in your document root to store the WordPress files (e.g.
/Library/WebServer/Documents/blog). - Go to the Settings panel in your WordPress admin console.
- In the box labeled WordPress address (URL), append the subdirectory name (e.g.
/blog). - In the box labeled Blog address (URL), append the same subdirectory name.
- Click on Save Changes. Now your blog is unreachable, which is perfectly fine because we didn’t move the WordPress files yet.
- Move the WordPress files from the document root to the
/blogsubdirectory.
Since there is no content at the root of your website, we will add an index.php file which redirects the user to your blog. Open the Terminal app and enter the following command (substitute yoursite.com with your domain name):
$ sudo echo "yoursite.com/blog/'); ?>" > /Library/WebServer/Documents/index.php
Restart Apache:
- Open the System Preferences and go to the Sharing panel.
- Un-check the Web Sharing item, wait a few moments.
- Check the Web Sharing item, close the System Preferences.
Open your browser and enter the URL to your domain. It should redirect immediately to your blog.
Configuring SEO-friendly Permalinks
SEO is short for Search Engine Optimization, which is a term to describe all measurements to help the search engines find your blog postings. In this case, we will contribute to SEO by putting the title of the article in the Permalink.
Follow these instructions:
- Go to the Settings panel in your WordPress admin console.
- Go to the tab Permalinks.
- Choose a Permalink setting (Day and name would be perfect).
- Click Save Changes.
Wordpress is now trying to create a file named .htaccess. If it succeeds, you just get the message ‘Permalink structure updated‘. Proceed with Fixing the Apache config below.
If it doesn’t succeed, it prints a message and the contents of the .htaccess file it wants you to create manually. In this case, open the Terminal app and enter the following commands:
$ sudo chown -R _www:admin /Library/WebServer/Documents
$ sudo chmod -R 774 /Library/WebServer/Documents
We changed the permissions of the document root and all its files/directories to be write-enabled. For a more detailed persmissions layout I suggest you read this.
Now you can try the Permalink instructions again, it should work now.
Fixing the Apache config
Unfortunately, we’re not finished yet: the default Apache config as shipped with Leopard is quite restrictive in what is allowed by the web applications. If you test the new Permalink URL the webserver fails you. Fortunately we only need to adjust one configuration element:
- Enter
sudo vi /etc/apache2/httpd.confin your Terminal. - Find the section
<Directory "/Library/WebServer/Documents">. - In this section, find the
AllowOverridedirective. - Change the directive to
AllowOverride FileInfo - Save the file, restart Apache.
You’re finished! All should work now. Open your browser and enter the URL to your blog. Click on one of the headlines, and check whether the URL is formatted like http://yoursite.com/blog/2008/08/20/your-post-title/. If this doesn’t work, please share in the comment section.
Cheers!
edit: fixed chmod/chown instructions
edit: fixed AllowOverride instructions

February 17th, 2009 at 10:59 pm
Can’t get these to work (2.7).
Here’s what I have in my virtual host file:
AllowOverride All
Options Indexes FollowSymLinks
July 29th, 2009 at 3:45 am
Bart,
You neglected something in the last part of the instructions:
1.) Enter sudo vi /etc/apache2/httpd.conf in your Terminal.
2.) Find the section .
3.) In this section, find the AllowOverride directive.
4.) Change the directive to AllowOverride FileInfo
5.) Save the file, restart Apache.
Note that item 2 talks about a section…but note that its not telling you WHAT section of the httpd.conf file…
Same thing with item 3.
Miles.
July 30th, 2009 at 3:09 pm
You’re right, something is missing there.
I’l look into it tonight and fix the text. Thanks for pointing this out!
July 31st, 2009 at 12:19 am
Found the missing section name: it appears to be. Fixed the text!
July 31st, 2009 at 12:20 am
Oh my. I mean: <Directory “/Library/WebServer/Documents”>.