If you are trying to run an update via the WordPress admin installed locally on your Mac you may have run into the error “Failed to connect to FTP Server localhost:21”.

This is possibly caused by ownership and permissions issues on the files. When you installed your WordPress site it may have been owned by yourusername:staff which doesn’t allow the user/group _www (which Apache runs as on OSX) to make modifications.

To solve this, open up Terminal on your computer and run the following command (make sure to update /path/to/wordpress/ to the correct path for your WordPress root directory…

sudo chown -R _www:_www /path/to/wordpress/
sudo chmod -R g+w /path/to/wordpress/

You may also want to add your user to the apache group so you don’t have any trouble editing the files. Replace “yourusername” with your actual computer user name.

sudo dseditgroup -o edit -a yourusername -t user _www

To verify what your user name is you can open up Terminal and your username should be right before the dollar sign (ex: “macbook:~ yourusername$”) or you can…

  1. Open “System Preferences”
  2. Click “Users & Groups”
  3. Right click on your user from the list at the left
  4. Click “Advanced Options…”
  5. Your user name will be listed under “Account name”

Alternative

If you need to start fresh, you can set blanket permissions for folders and files to allow owner and group read/write/execute. Caution: this will adjust your owner, and permissions for all directories and files including and under whatever you set as your /path/to/wordpress.

cd /path/to/wordpress/
sudo chown -R _www:_www ./
sudo find . -type d -exec chmod 775 {} \;
sudo find . -type f -exec chmod 664 {} \;
3.7 7 votes
Article Rating
in Apache, WordPress
Subscribe
Notify of
guest
6 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
davood
davood
10 years ago

….does not work!!

James
9 years ago

This worked for me first time, fabulous. Nice one!

LAOMUSIC ARTS
7 years ago

Thanks a lot !

What works for me was :
sudo chown -R _www:_www ./
And verified with:
ls -lart

Jim
Jim
5 years ago

Thanks – Worked great with 10.13.4 OSX Server 5.6

Wish I found this 2 days ago!

Lucas G
Lucas G
2 years ago

thxx!