Running WordPress locally on Mac OS X Lion, Mountain Lion and Mavericks

Apple and WordPressWant to run WordPress on OSX? I’ve wanted to do it for a long time and finally got a round to do it.

Multisite: See notes below if you plan to run a Network of WordPress (aka multisite) on your Mac.

New: Here’s an alternative, take a look at WordPress on Pow (includes a “how-to add MySQL, PHP5.4.9 and Ruby 1.9.3“)


Update: Mountain Lion and Mavericks

Web Sharing in Mountain Lion is removed from System Preferences->Sharing (no idea why), so to start the web server, open Terminal (or iTerm) and enter:
 

apachectl main commands are: start, stop and restart. You can learn more about apachectl by entering the following in Terminal

apachectl is sufficient when you need to start, restart or stop the server while testing, but if you want the web server to start automatically after a reboot, you’ll have to enable the launch daemon for the server:

Create /var/mysql/mysql.sock if it doesn’t exist (or replace /var/mysql/mysql.sock with /tmp/mysql.sock further below)

Also, If you followed the instructions below earlier and upgraded your Lion to Mountain Lion, you’ll have to reenable PHP:

How I installed MAMP + WordPress

1 ) Installed Apache, MySQL and PHP on my Mac. I followed this excellent guide: OS X 10.7 Lion Development: Native MAMP with MySQL installer. Here’s the /Users/<username>/Sites/httpd-vhosts.conf I made:

2) Installed WordPress in /Users/<username>/Sites/wordpress

When I tried to install the first plugin, I got the dreaded FTP Connection Information required :/

Luckily, Google to the rescue, I found this fix to allow WordPress automatic plugin installation/update:

A) Changed the owner and permissions for the entire WordPress installation, assuming you installed WordPress in /Users/<username>/Sites:

B) Added the following to /Users/<username>/Sites/wordpress/wp-config.php:


How to create a WordPress multisite locally

1) Follow the instructions above, and create a separate database per multisite

Easiest is to create a path-based (that is use sub-directories) multisite. My multisite virtual host looks like this:

2) When WordPress is up and running, follow steps 2 – 6 in the Create a Network guide.

If you have any questions, please don’t hesitate to ask below. I’ll try to answer as soon as possible.

34 thoughts on “Running WordPress locally on Mac OS X Lion, Mountain Lion and Mavericks

  1. steve

    It should be possible to install plugins locally by only changing the the group to _www for wp-content and adding write permissions to group, then adding the define(‘FS_METHOD’, ‘direct’); line to your wp-config.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">