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 likely caused due to ownership and permissions issues on the files. When you installed your WordPress site it was probably 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…

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. Note that 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 {} \;
2 2 votes
Article Rating
in Apache, WordPress
Subscribe
Notify of
guest
6 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
davood
davood
7 years ago

….does not work!!

James
6 years ago

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

LAOMUSIC ARTS
4 years ago

Thanks a lot !

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

Jim
Jim
3 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 months ago

thxx!