Credit for this post goes entirely to Bhagwad Park. What you read below is his solution; I’ve only re-written it slightly. His post can be read here.
I like WordPress. Well, okay, I love it. But sometimes it does weird things—like asking to connect via FTP if I want to install a new theme. WordPress doesn’t normally need to do this. The problem is that the PHP process in the background runs as Apache instead of the owner of the WordPress files. Here’s how to get it to work.
Open Terminal on your Mac (or use whatever SSH software you like) and type the following:
sudo chown -R www:www /Library/WebServer/Documents/Moodle
The first part of the path I’ve written here (/Library/WebServer/Documents) is the default folder and I’ve added the /Moodle because that’s what my folder is called which has all the files for Moodle. Yeah, original, isn’t it? If you’ve named your folder something else (or if you’ve changed the default location) you will need to type in the proper path.
‘chown’ allows you to change the owner of files or folders; -R means recursive (meaning that it is to be repeated for every sub directory and their files; www:www means we are changing the permission to www user and the www group (it’s a special system used for executing PHP processes).
Again, thanks to Bhagwad Park without whom I would have been pulling my hair out.