Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save starlightsys/938f251b51488cb0391ae8f6e2140c57 to your computer and use it in GitHub Desktop.
Save starlightsys/938f251b51488cb0391ae8f6e2140c57 to your computer and use it in GitHub Desktop.
Configure Apache on Mac OSX with Environment Variables

Configure Apache Environment Variable on Mac OS

  1. Restart the computer in Recovery mode (hold down Cmd-R). Open Terminal and run:

     $ csrutil disable
    
  2. Restart the computer normally.

  3. Edit the Apache2 plist file with whatever editor you like (example using vim):

     $ sudo vim /System/Library/LaunchDaemons/org.apache.httpd.plist
    
  4. Add the following to the the plist file:

     <key>EnvironmentVariables</key>
     <dict>
       <key>HOME</key>
       <string>/Library/WebServer/Documents</string>
     </dict>
    
  5. Restart the computer again in Recovery mode. Open Terminal and run:

     $ csrutil enable
    
  6. Restart the computer normally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment