I have tried every option to get apache2 to work in Mountain Lion, and I am baffled by how impossible the task seems to be.

I just got a new iMac and on a fresh, clean install, I went about setting up apache to serve local sites.

Using the usual suspects of possible configuration changes, I can get apache to actually "start" but then things go downhill from there.

No matter how I define the local server root, I always get a Forbidden error. I can chmod the directory structure to 777 and I still get a Forbidden error.

I have set the server root as the default /Library/WebServer/Documents/, set it to /Users/myUserName/Sites/, /Users/myUserName/Documents/Sites, /Volumes/ExternalDrive/Site/ and any other possible combination, modifying /etc/apache2/httpd.conf and/or /private/etc/apache2/httpd.conf as well as the vhosts file and the myUserName.conf file. Nothing makes a difference.

I have restarted apache with sudo apachectl restart as well as sudo apachectl stop followed by sudo apachectl start.

Nothing works.

Can someone help me get this issue resolved? I am beginning to want to throw my brand new iMac against the wall.

Note, I am not a novice at this and I have set up dozens of Macs. However, nothing seems to work this time. I even reformatted and reinstalled the system again.

  • 1
    Did you enable DirectoryListings in Apache? Do you have an index.html file in your WebRoot? Commented Jan 28, 2013 at 9:14
  • When you say "I went about setting up apache to serve local sites." what have you done? Did you check that Apache worked on the brand new OS install before you did anything? What errors do you get in the Apache log? Commented Jan 28, 2013 at 9:47
  • @JakeGould The web sharing checkbox was removed in 10.8.
    – Lri
    Commented Jan 29, 2013 at 5:54
  • @ComicSans Yes to both.
    – Ali Samii
    Commented Jan 29, 2013 at 9:31
  • 1
    @JakeGould As Lauri said, Web Sharing was removed in 10.8. But further to that, I want to install custom compiled PHP, updated MySQL, latest phpMyAdmin, and a host of other enhancements. So, before I get those installed, I need to ensure that apache is running...and it won't.
    – Ali Samii
    Commented Jan 29, 2013 at 9:39

4 Answers 4


Run this command to see if you have errors in your configuration: sudo apachectl -t

You can find more info here.

  • 1
    I'm surprised no one else went down the configtest path and it might catch a permission error...
    – bmike
    Commented Aug 23, 2013 at 15:14
  • I actually solved this issue by doing what you suggest...months ago. I should have answered my question myself when I resolved the issue. However, glad that you answered it. I can now accept this as it did reveal some problems which I was able to resolve (although I no longer remember what the problems were).
    – Ali Samii
    Commented Aug 24, 2013 at 10:19

sudo apachectl start starts Apache and enables /System/Library/LaunchDaemons/org.apache.httpd.plist.

To make http://localhost/~username/ work, save something like this as /etc/apache2/users/username.conf:

<Directory "/Users/username/Sites/">
    Options Indexes MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all

I didn't have to edit any other files or httpd.conf.


If you're really struggling, you might give VirtualHostX a try… it's a Mac app that helps you configure apache to run multiple websites from a single Mac, but it works just as well with a single website. It's a paid app, but it has a 30-day trial period.

  • Not the type of solution I am looking for. I could easily try a BitNami stack for Mac OS as well, or MAMP Pro, but none of these are the same as a standard clean, self-managed AMP stack.
    – Ali Samii
    Commented Jan 29, 2013 at 9:41

Try MAMP or even MAMP Pro, both have software that you can start/stop your apache and mysql.


MAMP Pro also supports virtual hosts

  • The problem with MAMP and MAMP Pro is that they are slow to update the components. Of course, I could go ahead and update them myself, but then, why install a software emulating a software and update the emulating software when it is available natively on the system.
    – Ali Samii
    Commented Jan 31, 2013 at 16:58

You must log in to answer this question.

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