Auto-Update WordPress with XAMPP for OS X

XAMPP for OS X - WordPress

XAMPP is a great application for running your own local development environment. It’s available for Linux, Windows, and Mac OS X. Personally, XAMPP is the only local environment app I use.

Out of the box, XAMPP doesn’t allow for automatic updates inside WordPress. Not for plugins, not for themes, not for core.

The Problem

WordPress first wants to use FTP to upgrade your files because it has already detected that it can’t write to the files it needs to.

Let’s try adding a couple lines to our wp-config.php to get around this.

define( ‘FS_METHOD’, ‘direct’ );
define( ‘FS_CHMOD_DIR’, 0777 );
define( ‘FS_CHMOD_FILE’, 0777 );

That won’t work either, because WordPress still doesn’t have the correct permissions.

Here is the result of using the above defines:

Downloading install package from…
Unpacking the package…
Installing the plugin…
Could not create directory. /Users/jonathandingman/public_html/wp-content/plugins/plugin-test-drive/
Plugin install failed.

Still won’t work.

You certainly could just chmod -R 777 public_html to your site, but that’s generally insecure.

Let’s continue and do it the right way.

The issue at hand is that WordPress needs to the ability to write to the files that are being managed by WordPress.

By default, XAMPP uses “nobody” and “nogroup” as the User and Group for permissions when launching the httpd processes via the XAMPP Control Panel.

User nobody
Group nogroup

Which ends up spawning a process like this:

jonathandingman 11593 0.0 0.3 636700 10796 ?? S 3:41PM 0:00.38 /Applications/XAMPP/xamppfiles/bin/httpd

The Solution

The fix is to edit your httpd.conf file for XAMPP.

Open up terminal (I use iterm personally) and type this:

sudo open -e “/Applications/XAMPP/etc/httpd.conf”

Enter your administator password then search for “nobody” (without quotes.)

You will see the following two entries:

User nobody
Group nogroup

You need to change “nobody” to your local username. My happens to be “jonathandingman” (again, no quotes)

Mine ends up looking like this:

User jonathandingman
Group nogroup

Save and close the file.

Go back to your XAMPP Control panel, stop Apache, then start Apache again and you have smooth sailing from here on out.

If you have any questions or suggestions, please let me know in the comments.


    • By Jonathan Dingman on

      I personally like the flexibility of having my own environments though, where I’m not locked into just WordPress.

      I also prefer more control over the environments. Having managed linux systems for over 10 years, I feel at ease using XAMPP.

      But Instant WP could certainly be a good choice for some folks.

      Reply »

Leave a Reply

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