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…
- Open “System Preferences”
- Click “Users & Groups”
- Right click on your user from the list at the left
- Click “Advanced Options…”
- 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 {} \;
….does not work!!
From inside your WordPress root directory, can you run a
ls -l
to see the owner and permissions of the files and folders and send the results? (If you prefer to do it outside of a public forum, you can email me directly via the contact form)This worked for me first time, fabulous. Nice one!
Thanks a lot !
What works for me was :
sudo chown -R _www:_www ./
And verified with:
ls -lart
Thanks – Worked great with 10.13.4 OSX Server 5.6
Wish I found this 2 days ago!
thxx!