LAMP, MacOS, Unix

LAMP Stack Localhost Folder Permission Fix MacOS

LAMP stack localhost folder permission issue is a pure hell for those of us who aren’t expert in the UNIX system. You’ve surely faced the issue when you can’t access localhost folder, unable to upload files through your web app etc.

If you’re still unable to fix this issue or every time you create new project folder you have to run chown command, then this article is for you. After following this article you should no longer have the localhost folder permission issue.

I’ve used macOS Sierra while performing this fix and I believe this method should work for other macOS versions as well.

I’m assuming you’re using the default path for localhost which is:


If you have changed the default file path in apache config. Just replace the default path with your custom path while performing the commands below.

Change Owner:

sudo chown -R www:www /Library/WebServer/Documents/

This command will add www group as the directory owner. So you can perform the read and write tasks through web apps.

Change Mode:

sudo chmod -R 775 /Library/WebServer/Documents/

Running this command will enable www to perform any read & write tasks.

Add OS User To WWW Group

At this point, you will see you can perform any directory based actions through your web apps. But every time you try to create a new folder inside localhost directory or try to edit any file, it will ask you for the administrator password. To fix this run the command below:

sudo dseditgroup -o edit -a whoami -t user www

This command will add your local user to the www group and you should be able to create, delete and edit any files or folder.

Feel free to let me know in the comment below if you still have the same issue after following this article.

Tagged , , , ,

About Robin

A learner who loves technology very much. Dreaming to become a programmer but also enjoying the life.
View all posts by Robin →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.