soderlind.no

I code for fun

Running WordPress locally on Mac OS X Lion

| 11 Comments


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

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:

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# Set up permissions for VirtualHosts in ~/Sites
#
<Directory "/Users/<username>/Sites">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

# For http://localhost in the OS X default location
<VirtualHost _default_:80>
    ServerName localhost
    DocumentRoot /Library/WebServer/Documents
</VirtualHost>

#
# VirtualHosts below
#

# wp.local
<VirtualHost *:80>
    ServerName wp.local
    CustomLog "/Users/<username>/Sites/logs/wp.local-access_log" combined
    ErrorLog "/Users/<username>/Sites/logs/wp.local-error_log"
    DocumentRoot "/Users/<username>/Sites/wordpress"
</VirtualHost>

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:

$ cd /Users/<username>/Sites
$ sudo chown -R :_www wordpress
$ sudo chmod -R g+w wordpress

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

define('FS_METHOD', 'direct');

Running WordPress locally makes it much easier to develop WordPress plugins wherever you are :)

11 Comments

  1. Pingback: WP FTP frissítés OSX Lion alatt | Feljegyzések

  2. Pingback: Running WordPress Multisite with MAMP « Socializing the Network

  3. You legend!

  4. Hello,
    I’m just setting up a local installation of WordPress on my Mac with OSX Lion. I’ve managed to install it but I can’t update any plugins, import my blog etc (I’m new to all this so flying blind so to speak).

    I have read something about changing my FTP permissions? I don’t really understand what the article above is saying, could you please give some further info for me?

    Thanks a lot, hopefully you can help!
    Jarratt

    • You have to do the following:

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

      $ cd /Users/<username>/Sites
      $ sudo chown -R :_www wordpress
      $ sudo chmod -R g+w wordpress
      

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

      define('FS_METHOD', 'direct');
      
  5. Hi again,
    That’s great, all up an running now. Thanks a lot!

  6. Pingback: MAMP + Mac Lion + WordPress + FTP + auto update: The ultimate (?) solution | GlückPress

  7. Pingback: MAMP + Mac Lion + WordPress + FTP + automatisches Update: Die ultimative (?) Lösung | GlückPress

  8. So I am having a problem with permalinks after setting up my dev environment on OSX Lion. I have AllowOveride All in my httpd.conf and in my vhosts file as you show, mod_rewrite is enabled… Any ideas?

    Thanks!

    • Is your .htaccess writeable by wordpress ? Mine looks like this (and permalinks works):

      # BEGIN WordPress
      <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
      RewriteRule ^index\.php$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]
      </IfModule>
      
      # END WordPress
      
  9. seems like alot of trouble to me,

    i use mamp pro & coda,

    std mamp install and wordpress into a wordpress directory in the sites folder,no need for all that messing around for the same result, oh and everything works like its on a live server, mail,permalinks,updates for wordpress & plugins, .htaccess writeable etc etc

Click on a tab to select how you'd like to leave your comment

Leave a Reply

Required fields are marked *.

*