Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

OSX Mountain Lion removed the GUI for web sharing, but apache is still installed.

How do I start and stop the service? How do I get the service to automatically launch on startup?

share|improve this question
Its starts automatically, at least for me. Just type it should be there. – Wojciech Bednarski Aug 2 '12 at 21:51
@Lri No. I did upgrade from 10.7 – Wojciech Bednarski Aug 3 '12 at 16:29
up vote 77 down vote accepted

The LaunchDaemon for Apache is still there as well, so all you have to do it load it:

sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist

The -w makes it permanent, i.e. it'll be reloaded when you reboot.

share|improve this answer
How do you turn this off once it's started this way? – James McMahon Sep 5 '12 at 14:13
@JamesMcMahon: sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist – Gordon Davisson Sep 5 '12 at 14:14
Hmm, something is still running on localhost, I had assumed it was Apache, maybe I have something else running. – James McMahon Sep 5 '12 at 14:19
@JamesMcMahon: You can use e.g. sudo lsof -i:80 to see what process is listening on a given port. From there, this previous answer might help you track it down... – Gordon Davisson Sep 5 '12 at 14:58

Terminal Commands

Starting: "sudo apachectl start"

Stopping: "sudo apachectl stop"

Restarting: "sudo apachectl restart"

Launching on Startup

(See the marked answer in this thread)

share|improve this answer
Is there an equivalent ShutdownItems dir? Don't have OSX in front of me at the moment... – Rich Homolka Jul 30 '12 at 20:33
There used to be /etc/rc.shutdown.local -- not sure if that is still around... – slifty Jul 30 '12 at 20:37

sudo apachectl start also enables the launchd daemon. It overrides the Disabled key in /System/Library/LaunchDaemons/org.apache.httpd.plist by modifying /private/var/db/launchd.db/, just like launchctl load -w.

For http://localhost/~username/ to work, you have to create /etc/apache2/users/username.conf and add a <Directory> directive like this:

<Directory "/Users/username/Sites/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
share|improve this answer
I found a really great writeup of this, here. Also covers php module enablation.… – Peter Ehrlich Oct 13 '12 at 19:35

Slifty and Lauri hint at an important concept without clearly saying it.

"sudo apachectl start" will not only start apache but will also modify /private/var/db/launchd.db/ so that apache will automatically restart each time the system is rebooted.

Similarly, "sudo apachectl stop" will stop apache and modify the above file so that apache won't start when the system is rebooted.

This seems to be the simplest way to control whether the service starts automatically.

share|improve this answer

For those in search of a GUI, Click On Tyler has developed a control panel app,

GUI sample

share|improve this answer
Nice widget.. however in my system something went wrong and apache is not starting..:( – Dilip Rajkumar Oct 14 '12 at 5:20
Same here. Seems to be a little bit sloppy coded - good old confusion about the .pid-file I guess ...zzz – conny Nov 2 '12 at 12:14
This is cool.. But outdated, doesn't work on Yosemite. How do we remove this from our settings pane? – apptality Feb 21 '15 at 23:37
To Delete: ~/Library/PreferencePanes – apptality Feb 21 '15 at 23:38

This preference pane has the links for computer site folder and to open a browser :

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.