Solved: Apache won't serve files from external drive on macOS

If you've tried to develop a website and the files are on an external drive, you might find that httpd will refuse to serve the files. In your browser you'll see:

You don't have permission to access this resource.Server unable to read htaccess file, denying access to be safe

And in your Apache error log you'll read:

[core:crit] [pid 45683] (1)Operation not permitted: [client] AH00529: /Volumes/externaldrive/website/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/Volumes/externaldrive/website/' is executable

The trouble is, you've checked that the directory is readable and it is. Permissions are correct! You might even have messed with the "Ignore ownership on this volume" checkbox but it doesn't fix the problem.

For me, the issue was caused by macOS's builtin Security and Privacy controls. I'm using MacPorts to install my development stack. I have MacPorts set to use launchctl to start my httpd server in /Library/LaunchDaemons/org.macports.apache2.plist. This plist uses the daemondo wrapper to start httpd.

After giving daemondo (and thus its child process, httpd) Full Disk Access, everything was happy.

Apache, MySQL, PHP on OS X 10.9 Mavericks with MacPorts

I shared my LAMP/MAMP build script on Github.

Subscribe to RSS - MacPorts