Install WordPress on Mac OS X Tiger

There are a couple of tutorials showing how to install WordPress on Mac OS X, the best one of which (IMHO) is a little outdated. The famous 5-minute install in my experience took a bit longer because it required certain amount of tweaking. Here’s how I did it myself.

  1. Download the latest version of WordPress. Double-click the archive to extract its content and put the whole folder in ~/Sites. You can, of course, put it in /Library/WebServer/Documents/. This tutorial assumes you choose your home directory, though. You can optionally rename the folder to “blog” or something you like. If you do rename it, just replace the appropriate file paths in the tutorial.
  2. Download and install MySQL. If you don’t know what it is or how to manage it, don’t worry. The installation is extremely straight-forward and, by the way, includes an optional start-up item and a preference pane, which is nice. I recommend you install both of them.
  3. When you’re done, open the Terminal, located in /Applications/Utilities. You are going to use it a little.
  4. To save yourself time interacting with MySQL in command line, add the following line to ~/.bashrc:
    PATH=${PATH}:/usr/local/mysql/bin
  5. Launch the MySQL server by opening System Preferences, the MySQL pane and clicking “Start MySQL Server”.
  6. Now you are going to configure MySQL. First of all, you need to create MySQL’s administrator account with a proper password. Type these commands in the Terminal (enter a real password instead of YourNewPasswordHere):
    cd /usr/local/mysql/bin/
    ./mysqladmin -u root password YourNewPasswordHere
    ./mysql -u root -p

    You have just logged into the MySQL server as root. Note that this is not the same root which owns every system file on your Mac. MySQL maintains its own users whose names do not have anything to do with accounts on your machine. So MySQL’s root can (and should, for security reasons) have a different password. You will be greated with the MySQL prompt. Enter your MySQL’s root password:

    Enter password:
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 1 to server version: 5.0.26
    
    Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
    
    mysql>

    Great, now you will create a database, in which WordPress will store your posts, users’ comments and whatever else it needs for you to be a happy blogger. For the sake of this tutorial I have named the database “wordpress”, but your choice is yours:

    mysql> CREATE DATABASE wordpress;
    Query OK, 1 row affected (0.00 sec)

    Now WordPress needs its own MySQL account to access and modify its database (enter some non-trivial username and password, because your WordPress administrator web interface will be open in the wild and anybody will be able to try guessing them):

    mysql> GRANT ALL PRIVILEGES ON wordpress.*
    TO 'wp_admin'@localhost IDENTIFIED BY 'wp_password';
    Query OK, 0 rows affected (0.03 sec)
    
    mysql> quit
    Bye
  7. Enable PHP. If you are comfortable with UNIX text editors, use your editor of choice to open /etc/httpd/httpd.conf, otherwise type this command in the Terminal and give your administrator’s password:
    sudo open /etc/httpd/httpd.conf

    Hopefully, this will open Apache’s configuration file in the TextEdit so that you can save changes.
    Uncomment these two lines:

    LoadModule php4_module
    AddModule mod_php4.c

    Save changes.

  8. This step was not required on my Mac, but you may need it on Mac OS X Server. If PHP fails to connect to the MySQL server, you have to point PHP to the right socket by editing a line in /etc/php.ini.default:
    mysql.default_socket = /tmp/mysql.sock
  9. Start Apache. You can do it in the Sharing pane of System Preferences where it is called “Personal Web Sharing”. This will also allow other people access your Mac’s web server. Since I was just setting up WordPress to design the web site locally, I launched Apache from the Terminal so that the built-in firewall would not open any ports:
    sudo apachectl start
  10. Check PHP. Create a text file, call it “index.php” and put it in ~/Sites:
    < ?php phpinfo(); ?>
  11. Edit wp-config-sample.php in ~/Sites/wordpressand rename it wp-config.php:
    define('DB_NAME', 'wordpress'); // database name, see step 6
    define('DB_USER', 'wp_admin'); // your MySQL username
    define('DB_PASSWORD', 'wp_password'); // ...and password

    If your installation does not work, you may also have to change localhost to 127.0.0.1 on the next line, containing the value of DB_HOST.

  12. Edit /etc/httpd/users/yourusername.conf:
    Options Indexes MultiViews FollowSymLinks SymLinksIfOwnerMatch
    AllowOverride All
  13. Point your favourite browser to http://localhost/~yourusername/wordpress/wp-admin/install.php and follow the instructions.

13 Responses to “Install WordPress on Mac OS X Tiger”

  • Thanks! This helped a lot, the other instructions available were outdated.

  • i was having all kinds of trouble doing this. your article was the one that guided me in the right direction. simple, clear, concise and lacking any assumptions. well done.

    thanks!

  • thanks! It works for me, too.

  • Hello: I found you tutorial extremely helpful.
    I was able to get our blog up and running in no time.
    I am not too familiar with mysql.

    How do you go about adding multiple blogs using the configuration.
    Specifcally, how to do you add multiple wordpress databases.

    ANy help would greatly be appreciated.

    Thanks Rob

  • I am still having trouble getting wordpress to communicate with mysql database. I continue to get “Error establishing a database connection”

    all passwords etc check out. any help appreciated.

  • thanks you

  • BIG THAAAAAAAANKS TO U

    ur tutorial really help me

    but i have one quastion is the database of MySQL is the same datebase for our website orr we have to add this datebase to the one for te website ??????

    to be more clear i bought a domain from godady and i dont know yet if it gave me the same datebase

    i mean i dont know hoe i add this datebase to my website

    could u help me pleeese

  • Sara, it is highly recommended that you make a separate database for WordPress. You should contact your hosting provider for further assistance.

  • I also continue to get the “Error establishing a database connection” error inspite of following your steps and checking my passwords. I also know for a fact that mysql is running… Please help

    thanks

  • OK, I now used ‘127.0.0.1′ instead of ‘localhost’ and it seems to be working!!! Many Thanks

  • I’m impressed with you good and very informative article.

  • great post thank you

  • a very successful site. Also very revealing article. Thanks to the contributors.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>