Runtime: 10 Minutes
More than a year ago, I wrote an article detailing how to Install and Configure WordPress on Mac OS X, which walks you through the entire process of installing WordPress, setting up permissions, installing MySQL and using MySQL Workbench to set up your database.
Another article I wrote on how to Host multiple subdomains on Mac OSX 10.6 also is quite popular with developers on mac.
Due to the popularity of these two articles, I’ve decided to write a companion article for those who have followed my advise in the past.
This article just includes those steps for creating a new wordpress website and adding a new subdomain on your localhost. Sometimes it’s hard to remember all the steps involved (especially if it’s been a while).
This article assumes the following:
- You’re using Mac OS X.
- You have MySQL installed.
- You have MySQL Workbench or PHPMyAdmin installed. (So you can create a new database.)
- You have apache configured to support multiple subdomains.
- You have a text editor capable of opening hidden files in hidden folders.
If the above is true, bookmark this article so you have all the steps you need to install a new instance of WordPress.
Step 1: Download the latest copy of WordPress.
Download the latest build of WordPress (3.3.2 as of this writing).
Step 2: Extract WordPress
Copy the entire contents “wordpress” folder to a new folder inside your “Sites.”
Step 3: Open Terminal and Edit WordPress Permissions
WordPress runs as user “_www” according to the rules in your httpd.conf (apache configuration) file. WordPress needs permission to modify some files during the installation process. It also needs permission to download and install plugins and updates, so it’s best to get the permissions correct now and save yourself some trouble later.
Fire up terminal and use the command line to navigate to your “Sites” folder.
You may want to view the permissions on all the folders there.The following command will display your directory contents and permissions:
In the screenshot above, I can see that the permissions are not correct for my new site, Launchpad.com.
Next, change the ownership and modify the file permissions so that user _www (apache) can read, write and execute. You’ll be running this as super user “sudo” so you will be prompted for your administrator password.
sudo chown -R _www launchpad.com
sudo chmod -R g+w launchpad.com
(Change “launchpad.com” to whatever your new site is called).
Step 4: Edit your httpd.conf file
Open the httpd.conf file located at
or /etc/apache2/extra/httpd-vhosts.conf on OS X Lion
(This is where BBEdit comes in handy, since the folder and file is hidden.)
Since you’ve already got multiple sites configured, scroll down to the last of your sites, use copy/paste to create a new entry and change all the file paths and the ServerName. The servername will be the name of your new subdomain (e.g. launchpad.localhost).
Step 5) Edit your hosts file at
Add your new subdomain at the bottom. Be sure it matches what you put in your httpd.conf file under ServerName.
Step 6) Restart your web server.
Open System Preferences, go to Sharing and toggle Web Sharing off and then on again. This will restart apache and load your new configuration changes.
Note that this preference pane option is no longer available in OS X Lion and up. Instead, type this command into terminal to restart apache:
sudo apachectl start
(You’ll be prompted for your admin password.)
Step 7: Add a new database for your new WordPress site.
Use MySQL WorkBench or phpMyAdmin to create a new database and a new user. Take note of the database name, username and password.
For detailed instructions on how to do this, see step 6 in my article on installing WordPress for the first time on Mac OS X.
Step 7: Installing WordPress (Finally!)
Okay, by now you’ve…
- downloaded a fresh copy of WordPress.
- copied the files to your “Sites” folder.
- modified the permissions.
- edited your httpd.conf file and your hosts file.
- created a database and user for WordPress.
Now you’re ready for the fun part!
Point your browser to your new subdomain (e.g. http://launchpad.localhost ).
WordPress will now ask you for the following information. (Example answers provided.)
Database Name: launchpad
User Name: launchpadusr
Database Host: 127.0.0.1
Table Prefix: wp_
By default, WordPress fills in the “Database Host” field with “localhost”. I’m not sure why, but this doesn’t work! You’ll get a database connection error unless you use 127.0.0.1.
If your wordpress folder permissions are correct, the installer will be able to save the wp-config.php file.
Next, Run the install. All you have to do is enter few more details and you should be using your new wordpress site in no time.