WordPress on OS X: Permission for Media Library uploading

If you’ve installed WordPress on OS X and receiving the error:

"somefile.jpg" has failed to upload due to an error

"somefile.jpg" has failed to upload due to an error

“somefile.jpg” has failed to upload due to an error
The uploaded file could not be moved to /pathtouploadsfolder/

Then the following fix might help.

The problem is due to the fact that WordPress runs as user “_www” on OS X and the permissions need to be set correctly. This same permissions problem will also affect your ability to install and update plugins and update WordPress.

Let’s fix it.

Open terminal and change directory to just above your WordPress site:

cd /Users/Username/Sites/

Assuming your WordPress site is in a directory called “wordpress”, type the following:

sudo chown -R _www wordpress

Terminal will then prompt you for a password with the privalages to make the change (i.e. root).

Next, type the following:

sudo chmod -R g+w wordpress

That should fix it. “Get Info” on the WordPress folder and you should see that the owner has changed:

Correct WordPress Permissions on OS X

Notice the _www user has Read & Write permissions now.

You should now be able to upload files.

WordPress upload problem fixed.

Note: Frequently, my website project folders have spaces in them. e.g. “WordPress 3.1″. If this is the case with your installation, then terminal will tell you it can’t find the path. Surround your folder name with “” (quotes), and that will fix the problem:

cd /Users/Milkman/Sites/
sudo chown -R _www “wordpress 3.1″
sudo chmod -R g+w “wordpress 3.1″

This entry was posted in Techno-babble, WordPress. Bookmark the permalink.

2 Responses to WordPress on OS X: Permission for Media Library uploading

  1. prajnamu says:

    Whoaa! Great Post! I was stuck on uploading error from my wordpress page, and your tutorial to set the folder permission setting is saved me.

    Thanks a million! :D

    Oh btw, I wish you write something else about, Virtual Host setting :D

  2. Rodrigo says:

    Worked fine. :-) Thanks!

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> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>