Category Archives: Mac

Tips on Install of WordPress on Mac OSX

Prerequisites / WordPress Dependencies

Local Apache web server with PHP & Mysql.

If you don’t already have your local dev environment set up, consider installing MAMP or MAMP Pro. MAMP is a one-click install which will provide you with a clean, isolated stack for local development that has Mysql and PHP pre-configured. Another benefit of MAMP is that it is very popular so there are countless tutorials and examples to follow.

If for some reason you don’t want to use MAMP or you’ve already configured your local enviro somewhat but you still need PHP and/or MySQL, check out this article: Install and Configure WordPress on Mac OS X Snow Leopard Step-By-Step by awilliams of Thermal Exposure. It takes you from zero to WordPress using Leopard’s built-in Apache server, although I do recommend you supplement these instructions with these tips and my other article Install Mysql for Local Dev on Mac OSX 10.6

Download WordPress

Download and extract the latest WordPress package.

Move it somewhere good like in your /Sites/ folder (most usual place but depends on your config, it can go anywhere you desire so long as your local web server is configured to look there).

I moved mine to /users/me/Sites/wordpress and renamed ‘wordpress’ to ‘wptest.loc’ resulting in: /users/me/Sites/wptest.loc. You can rename it whatever you want – probably the name of your project or client’s site is a good idea.

WordPress needs permission to modify files during installation and runs as user “_www” so make sure it can do this.

cd /Users/me/Sites/
sudo chown -R _www wptest.loc
sudo chmod -R g+w wptest.loc

Create a Database

Now we need a database, a database user and a password. Technically you can use any user or add WordPress tables to an existing database but I like to keep things separate so it’s easy to port elsewhere or start over without worrying about wrecking other things. I’m going to create a database called wptest, database user named wptest_user. You can do this using a GUI (phpMyAdmin, etc.) but I guarantee you cannot do that faster than I can type this ;)

bash > mysql -u root -p
mysql > create database wptest;
mysql > GRANT ALL ON wptest.* TO wptest_user@localhost IDENTIFIED BY "secretpassword";
mysql > exit

Configure Site Address

Remember how I renamed the wordpress folder to wptest.loc? This is because I plan on accessing it in the browser via http://wptest.loc instead of or http://localhost.

To do this I use Virtual Hosts in my environment and point the virtual domains to my local IP address in my hosts file. It’s confusing at first but once you do it a time or two it will be second nature. It’s important if you’d like to work on multiple sites on your local environment concurrently and don’t want to rely on weird subdirectories or other work-arounds that wouldn’t easily port to a live web server.

Setting Up Virtual Hosts on MAMP explains how to set this system up. I provide only abbreviated steps below (MAMP not assumed).

Setting up Virtual Hosts (in short)

  • In your httpd.conf file there should lines like this:
    # Virtual Hosts
    Include /path/to/your/httpd-vhosts.conf

  • In your httpd-vhosts.conf file there should be a line like this:
    NameVirtualHost *:80
    Include /path/to/your/httpd-vhosts.conf

Create A Virtual Host

Now, whenever you want to create a new virtual (local only) site:

  • In your httpd-vhosts.conf file add an entry like this:
    <VirtualHost *>
        ServerName wptest.loc
        DocumentRoot "/Users/me/Sites/wptest.loc"
      <Directory "/Users/me/Sites/wptest.loc">
        Order allow,deny
        Allow from all
        DirectoryIndex index.php index.html

  • In your hosts file (mine is /etc/hosts) add another entry for your local IP:    wptest.loc

Install WordPress

Point your browser to http://wptest.loc

If no config file is found you can edit it yourself, wp-config-sample.php as wp-config.php and adding the correct information for the database you created. Try using as the Dataase Host if localhost doesn’t work.

Install Mysql for Local Dev on Mac OSX 10.6

Do not be intimidated, it’s not that hard.

If you don’t mind reading a little documentation, the hardest thing about installing Mysql (IMO) is figuring out what package to install.

If you’ve previously tried and failed (and done who knows what to your local config) or if you don’t have a particular reason not to, why don’t you just get MAMP and skip all this?

USE THIS INFORMATION AT YOUR OWN RISK. Any information found on this website is offered only as informational and includes no warranty, guarantees or support. The author claims no authority on any subject whatsoever.

  1. Go to
    • This will offer latest version (yes, you want the MySQL Community Server, btw) – if you have a good reason, you can access a previous version from here as well.
  2. Choose the DMG Archive for your architecture (32-bit or 64-bit). You’ll have to log in or (more likely if you’re reading this article) register with MySQL. It’s annoying but fast and I’ve never received spam from them.
  3. After jumping through sign in and mirror download hoops you’ll have a DMG file, something like mysql-5.x.x-osx10.6-x86.DMG which will contain an similarly named .pkg file. That’s all you need. But the most important file is the ReadMe.txt – which is actually useful and contains important steps you need to take. Open the ReadMe.txt.
  4. Read the ReadMe.txt file.

Ok, before you get mad at me – a lot of folks don’t provide useful ReadMe files, which is why I think it’s worth calling out in this case. Also, I saw so many tutorials on this, and worse, problems in forums where it was clear they didn’t follow the steps provided. Also, there are docs online that are mostly a repeat of this file – but it’s easy to accidentally read instructions for the wrong product version. So, as we OGs say, RTFM.

Following are notes from my specific install experience. It may be useful for you but you’ll need to verify your own system paths and configuration. Happy databasing!

  • Restarted apache a whole bunch, can’t remember when or exactly when you need to but if something doesn’t work, that might help:
    sudo apachectl -k restart

  • I installed MySQLStartupItem.pkg – while regularly using it this makes sense, and it’s easy to stop auto startup when you’re done working on a project using mysql. Also the commands to start Mysql are much shorter this way and I’m lazy.
    $ sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

  • Update my PATH environment variable:
    //make a back up in case you muck something up
    $ sudo cp /etc/paths /etc/paths_BAK 
    // edit your paths file - see vi reference or using pico, vim, emacs whatever
    $ sudo vi /etc/paths
    // insert /usr/local/mysql/bin and then save/quit
    // test result
    $ echo $PATH
    // do you see /usr/local/mysql/bin in there somewheres? good!
    $ mysql
    // is bash prompt replaced with mysql> ? yay!

  • Create a password for root:
    $ mysqladmin -u root password aw3^s0mePAs5

More good notes (for 5.5, be sure to select correct manual option):

What Next?

  • Login, create a db, do stuff, lern stuff
    $ mysql --help
    $ mysql -u root -p
    mysql> SHOW DATABASES;
    mysql> \h
  • Install a GUI - I like 'em, it's nice for visualization, although I think you definitely learn more & more better if you stick with CLI or at least the query window.
    • Sequel Pro - recently turned onto this. LOVE it. Good review here.
    • MySQL Workbench - the official one. Cause you're a company wo/man!
    • PHP MyAdmin - cause you an OG! And/or you follow or make a lot of tutorials (most apache web hosts provide this).
    • Querious - cause it's worth a few bucks for a nice user experience.
    • Navicat - cause money is no object! (If that's the case, please get me a copy! Love but cannot justify $$ at this time.)