HomeApple MacMac OS X LeopardLeopard: How to Install Wordpress

Leopard: How to Install WordPress

Installing a local version of wordpress is one of the first things most designers and developers need to do. Leopard adds many new wrinkles to this task. These steps should get you up and running as painlessly as possible on OS X 10.5.


*Install the MySQL Database*

– Download and install OS X version of MySQL from here: http://mysql.org/downloads/mysql
– Install the MySQL package. You can install the preference pane by dragging MySQL.prefPane to /Library/PreferencePanes however, it is not very helpful as there is a bug that prevents MySQL from being started with this.

*Manually Start MySQL*

In one terminal window type:
sudo /usr/local/mysql/bin/safe_mysqld

Close that terminal window, and start another:

sudo mkdir /var/mysql/
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

You’ll need to manually restart mySQL using the above steps, every time you reboot your system.

*Configure MySQL*

– Add this line to your profile:

export PATH=”$PATH:/usr/local/mysql/bin”

If you need help with this, you can edit .profile with textedit using these directions.

– Next the user will need to complete configuration from terminal. You will need to substitute your chosen MySQL root password for {ROOTPASS} and the Bonjour computer name (shown at the top of Sharing in System Preferences) for {HOST}.


$ mysql -u root
> drop database test;
> delete from mysql.user where User = '';
> flush privileges;
> set password for root@localhost = password('{ROOTPASS}');
> set password for [email protected] = password('{ROOTPASS}');
> set password for 'root'@'{HOST}.local' = password('{ROOTPASS}');
> quit

*Create the WP MySQL Database and User*

– {ROOTPASS} will the same as the above. The example creates a database named wordpress and grants privileges to user wpuser and sets that user’s password to wppass. You can change these if you want but remember the values for when you install wordpress below. I suggest just using these examples.


$ mysql -u root -p
Enter Password: {ROOTPASS}
> create database wordpress;
> grant all privileges on wordpress.* to wpuser@localhost identified by 'foo';
> set password for wpuser@localhost = old_password('wppass');
> quit

*Turn on PHP*
– Edit the following file: /etc/apache2/httpd.conf
– remove the “#” from the following line # LoadModule php5_module and save the file.
– If you have problems doing this, you want want to read the directions for using textedit as a superuser.

*Install WordPress*

– Download and extract wordpress from here: http://wordpress.org/latest.zip
– Copy the contents (not the actual folder) to your Sites folder under your user name. (example: /Users/davak/Sites/)
– In the Sites folder, open wp-config-sample.php with textedit (or vi or whatever) and save it as wp-config.php
– Change the following first lines of the document to point to your database. If you used the default values above, you can block replace this. If you changed the database name, username, or password, then you will need to update the code to match your choices.

define('DB_NAME', 'wordpress'); // The name of the database
define('DB_USER', 'wpuser'); // Your MySQL username
define('DB_PASSWORD', 'wppass'); // …and password
define('DB_HOST', 'localhost:/tmp/mysql.sock'); // 99% chance...

*Restart Apache*

From the terminal…
sudo apachectl restart

*Hit the WP Installation*

– Use your browser to navigate to your install. Replace “user” with your username…

http://localhost/~user/wp-admin/install.php

Here is mine, for example…

http://localhost/~davak/wp-admin/install.php

*May need to update virtual hosts*

If everything is not working correctly, you may want to update your virtual hosts with the following command. Remember to replace “user” with your personal username.

sudo cp /etc/httpd/users/user.conf /etc/apache2/users/user.conf

Here is my command, for example…

sudo cp /etc/httpd/users/davak.conf /etc/apache2/users/davak.conf

Then you will need to restart apache again.

sudo apachectl restart

Hit the page with your browser again.

*TroubleShooting and Credits*

You may have issues with permissions when trying to upload, import, etc. You can correct this by doing a chmod on your sites folder and subfolders.

From the terminal navigate to your sites folder and run something like the following…

chmod -R go+w *

This will grant group and others write permissions. If you need higher local security, then feel free to grant permissions by a more restrictive method.

This information was gathered from several sources. If you have problems or need additional information, I would reference my sources for this article. Please post additional recommendations and issues in the forum comments associated with this article.

http://www.angry-fly.com/index.cfm/2007/10/26/Fix-for-MySQL-on-Leopard
http://warker.com/2006/09/16/wordpress-os-x-install-tips/
http://remysharp.com/2007/10/27/lamp-in-leopard-osx-105-php5-and-apache-22/

David Kirk
David Kirk
David Kirk is one of the original founders of tech-recipes and is currently serving as editor-in-chief. Not only has he been crafting tutorials for over ten years, but in his other life he also enjoys taking care of critically ill patients as an ICU physician.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

LATEST REVIEWS

Recent Comments

error: Content is protected !!