This will only work with Mac OS X and Apache.
I have many WordPress installations locally. All of which grows outdated as time flies by. Normally I don’t worry about it since the live version is easily upgraded with WordPress automatic upgrade. But as of lately, I want to do this locally. But when I try to, WordPress asks for FTP-credentials.
So here is how you can bypass it.
First of all, add the following lines to your wp-config.php
define('FS_METHOD', 'direct'); define('WP_TEMP_DIR', ABSPATH.'wp-content/tmp');
Create a folder called tmp in your wp-content folder and make both of them writable.
Now, whenever you want to do an upgrade do the following steps:
- Fire up Terminal and browse to your WordPress folder
- Change ownership of the WordPress files to your Apache user. By default your user is called _www, as well as your group.
sudo chown -R apacheuser:apachegroup .
- Do the automatic upgrade!
- When you are finished revert the ownership back to yourself
sudo chown -R yourmacuser .
I have seen other blog posts about this, but all of them involved changing a lot of file permissions, which I didn’t feel comfortable with. So I follow these steps every upgrade and it works pretty well!