I have followed this guide to set-up Apache on High Sierra: https://coolestguidesontheplanet.com/get-apache-mysql-php-and-phpmyadmin-working-on-macos-sierra/

I used it to set it up on Sierra.

But when I go to http://localhost/~scott/ I get "Forbidden. You don't have permission to access /~scott/ on this server."

A suggestion on this similar question: localhost / userdir on macOS High Sierra is to load vhosts. Which I've tried, but still get "Forbidden".

Has anything changed between Sierra and High Sierra which would be preventing Apache from working with user Sites folders?


15 Answers 15


This worked for me when I ran into the same problem.

Please check "/private/etc/apache2/extra/httpd-userdir.conf" file.


#Include /private/etc/apache2/users/*.conf


Include /private/etc/apache2/users/*.conf

and restart apache.

From: https://stackoverflow.com/questions/39631351/apache-localhost-403-forbidden-with-macos-sierra

  • That line in /private/etc/apache2/extra/httpd-userdir.conf is already uncommented, from the instruction link I followed. Sep 28, 2017 at 19:08
  • did you restart apache "sudo apachectl restart"
    – Robert
    Sep 29, 2017 at 18:38
  • Yes. I have done with all changes to Apache's configuration files Oct 2, 2017 at 21:03
  • Yeah, can confirm this doesn't work, even with restarting apache. Aug 16, 2021 at 17:08

To allow access to the Sites directory, you have to add the following to /etc/apache2/httpd.conf:

<DirectoryMatch "/Users/.*/Sites">
  Require all granted

The default Apache configuration is set to denied on /, so you have to explicitly allow access to everything.

  • 2
    Added and restarted apache. Didn't make any difference Nov 7, 2017 at 20:07
  • I had the same problem. Was getting the "It works!" on locahost, but could not get the user directories to work. Fixing the DirectoryMatch rule like this solved it. Thanks!
    – Karra
    Apr 22, 2019 at 0:05

Just to expand on to Diogo Lima's answer.

With the upgrade to High Sierra, Apple made copies of your previous apache settings and appended a ~previous to the *.conf files both in the /etc/apache2 and the /etc/apache2/extra folders. If you are using virtual hosts or ssl-virtual hosts then you will need to also move your previous versions for those .conf files as well.

mv /etc/apache2/extra/httpd-vhosts.conf~previous /etc/apache2/extra/httpd-vhosts.conf
mv /etc/apache2/extra/httpd-ssl.conf~previous /etc/apache2/extra/httpd-ssl.conf
  • 1
    This was a clean install of High Sierra, so I didn't have any previous configuration files Nov 11, 2017 at 10:08
  • So, just to clarify, you had it working on Sierra, but didn't do an upgrade, but rather a complete clean install? I recall when I set up getting it working on Sierra that I created a symbolic link from my Sites folder to the /Library/WebServer/Documents folder and made sure I had granted myself permission (read and write). Since it sounds merely to be a permissions issue at this stage, have you made the symbolic link and changed permissions? Nov 13, 2017 at 3:03
  • Yes, that's correct. I always do a clean install of new macOS versions. I'm aware I can do that, but I want to maintain both /Library/WebServer/Documents and Users/username/Sites as separate locations for web projects, as that's what I've been able to do on macOS for the last 10+ years. Nov 14, 2017 at 8:15
  • So it looks like you would need to run two separate instances of Apache on the same machine but wouldn't that defeat the whole purpose of load balancing the websites that Apache now offers when run from a single instance? Apple's best practices recommendation is to no longer use the Users/username/Sites and stick with the Library/Webserver/Documents Nov 15, 2017 at 9:12
  • The single Apache instance is cable of reading web projects from multiple directories. That's how I've had it set up for years. Nov 16, 2017 at 9:18

After trying all the above methods, if you still get "forbidden" when accessing localhost, try adding virtualhost in your /etc/apache2/extra/httpd-vhosts.conf


<VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents/

then restart apache.


works fine for me

  • Does not work after adding and restarting Apache. Aug 16, 2021 at 17:11

I was on the same situation, apparently there are a few more lines to uncomment in httpd.conf, vhosts are not activated on High Sierra. - https://apple.stackexchange.com/a/299929/259065

  • I had already uncommented both of those lines. Makes no difference Oct 11, 2017 at 21:00

Just updated this morning. Using Sites folder in /Users/username.

Backed up and replaced httpd.conf,httpd-userdir.conf and https-vhosts.conf w/ the ~previous variants.

Ran sudo apachectl configtest and got the PHP error (PHP updated to 7 in High Sierra). Edited http.conf to start PHP7 and now everything is working again.

  • +1 for including note sudo apachectl configtest
    – David C
    Apr 2, 2018 at 15:47

Possible solution (after failing with all the above suggestions). The issue is with the permission of the home directory. It should be executable for group/others:

sudo chmod go+x /Users/username

where "username" is to be replaced with the actual username. After this, it works!


Phew!! I figured it out myself.

Do these steps

Step 1: Open your terminal and run this command below

sudo atom /etc/apache2/httpd.conf

And then Uncomment the Line by removing the "#" sign before it

LoadModule php7_module libexec/apache2/libphp7.so

Step 2: Run the following command mentioned below

cd /private/etc

sudo cp php.ini.default php.ini

Step 3: Then go to your /Library/WebServer/Documents directory and do a

sudo chown -R  root yourprojectname

Go back to your Safari browser and type in "http://localhost/yourprojectname"

You are all set to go.

I am using MacOS High Sierra 10.13, it got updated yesterday morning.

  • localhost running from /Library/WebServer/Documents is working fine. The problem is running localhost/~scott from /Users/Scott/Sites. Oct 2, 2017 at 21:07

Spent the whole morning to figure it out, but finally it worked. Hope this can be useful for somebody.

I followed a guide, but with a slight change.

Now I can access localhost folders, but...

Before high-sierra it was like: http://localhost/~username/smomesite.local

Now is like: http://localhost/smomesite.local

No more ~username required.

  • I don't want to change the default apache web path to my user folder. In previous version of macOS I've been able to run files/sites from both the Users/myname/Sites directory and /Library/WebServer/Documents Nov 7, 2017 at 20:10

I just had this same issue, and wanted to do exactly what you wanted (keep the root at /Library/WebServer/Documents, but also allow user Sites folders). I'm not sure if this will be helpful, but after banging at this for hours tonight, looking line by line thru all of the .conf files, and wondering what was wrong, I realized that httpd process wasn't able to read my own user directory. For some reason it was set as 750, and the _www user is unable to read it. Once I fixed that by running "chmod 755 ." on my user directory, the Sites folder showed right up.

I'm not sure how my own user directory got like that, as it appears that they default to 755 when I create a new user. And I had already double-checked many times that my Sites folder was set to 755.

  • Just tried that and restarted Apache. Still "Forbidden: You don't have permission to access /~username/ on this server" Nov 11, 2017 at 10:11

I had the same problem. I uncommented the two lines below (as already suggested in another response)

#LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so 
#Include /private/etc/apache2/extra/httpd-vhosts.conf

But still got the same error. The trick for me was uncommenting these additional lines in the httpd.conf file:

#LoadModule userdir_module libexec/apache2/mod_userdir.so 
#LoadModule include_module libexec/apache2/mod_include.so 
#LoadModule rewrite_module libexec/apache2/mod_rewrite.so

Hope that helps.

  • I've already uncommented those lines Nov 14, 2017 at 8:16

It happens that the update moved all your previous configuration to the files .conf~previous. If you move /etc/apache2/extra/httpd-userdir.conf~previous to /etc/apache2/extra/httpd-userdir.conf, and /etc/apache2/extra/httpd.conf~previous to /etc/apache2/extra/httpd.conf, it should work like before.

mv /etc/apache2/extra/httpd-userdir.conf /etc/apache2/extra/httpd-userdir.conf~high-sierra
mv /etc/apache2/httpd.conf /etc/apache2/httpd.conf~high-sierra
mv /etc/apache2/extra/httpd-userdir.conf~previous /etc/apache2/extra/httpd-userdir.conf
mv /etc/apache2/httpd.conf~previous /etc/apache2/httpd.conf
apachectl restart
  • This was a clean install of High Sierra, so I didn't have any previous configuration files Nov 7, 2017 at 20:08

I have had the same issue. The resolution was easy. See answer posted here: https://apple.stackexchange.com/a/306390/129503

I faced the same after I upgraded to High Sierra earlier today. I found that the following apache files were replaced with brand new versions. Fortunately for all of these files there existed a FILE~previous file in the same folder. I just copied the ~previous version back to the original ones, restarted apache and everything was fine.

In folder /etc/apache2 :



cp /etc/apache2/httpd.conf~previous /etc/apache2/httpd.conf



from older ~previous files.

The you might get php5 module error in httpd.conf, replace php5 with php7 and your sites should start working.


LoadModule php5_module libexec/apache2/libphp5.so


LoadModule php7_module libexec/apache2/libphp7.so

I just upgraded and had exactly the same issues. I don't use vhosts. Solution for me was ensuring:

In https.conf uncomment

LoadModule userdir_module libexec/apache2/mod_userdir.so

LoadModule authz_host_module libexec/apache2/mod_authz_host.so

LoadModule authz_user_module libexec/apache2/mod_authz_user.so

LoadModule authz_core_module libexec/apache2/mod_authz_core.so

and ensure the extra/httpd-user.conf has the line:

UserDir Sites

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .