Search code examples
phpmacosapachelocalhostprivileges

Write Privileges - localhost - Mac OSX


I'm new to the mac world and have just been setting up my webserver. I used the following guide: https://alan.ivey.dev/posts/2011/os-x-10.7-lion-development-native-mamp-with-mysql-installer/

I've transferred my sites and databases and everything is going pretty well. The only problem I have is with the writing permissions. For example there is a config file that needs to be written to, and I had to right click, go to Get Info then enable read & write for staff and everyone.

I can't manually go through and enable these write privileges for every file/folder. I didn't need to do this using WAMP and made development much quicker.

So wondering about 2 possible solutions: a) add my user account to a whitelist for the localhost so that 644 privileges are sufficient b) set the write privileges recursively


Solution

  • I found the best solution was to change the apache user and group settings. The instructions can be found at: http://paulmason.name/item/change-apache-user-group-in-lion-os-x

    1. Open Terminal and Enter

      sudo nano /private/etc/apache2/httpd.conf
      
    2. Find and change http.conf code from

      User _www
      Group _www
      

      To

      User your_mac_username
      Group staff
      

      Note: With earlier versions such as Leopard, capitalize staff to Staff. You can get your username and group by typing "id" and hitting enter in terminal

    3. Restart Apache

      sudo apachectl restart