Turn Off the built in apache on OSx

How to turn off and turn back on the built in apache on OSx

There are a handful of reasons why you would want to turn off the built in apache on OSx, you might have installed your own version, maybe you don’t use apache and it is interfering with something else, whatever the reason there is one command to turn it off.

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

You should run that from Terminal.app

Explanation of launchctl

I wanted to take a second to explain what is going on because too often people (myself included) will post a code snippet without explaining what it is, the worrying this is so many people run them without checking what is happening.

sudo tells your computer to run the following command as the root (administrator) account.

launchctl is an OSx program that interfaces with launchd, which is a daemon manager. Daemons are small programs that run as background processes (like what would setup Apache).

unload tells launchctl to unload a specified configuration file.

-w tells launchctl to override a disabled key. This will force the file to be marked as disabled.

/System/Library/LaunchDaemons/org.apache.httpd.plist is the file that we are unloading.

Adding Apache back in

If you want to load Apache back in, we simply need to run the same command with load instead of unload:

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

Hopefully that helps! If you have any questions, please look through the comments as lots of smart people have been talking in there.


Recent posts View all

Ruby

Forcing a Rails database column to be not null

How you can force a table column to always have something in it with Rails

Writing Marketing

We've deleted an article's worth of unhelpful words

We've improved several pages across our site by removing words that add no value, and often detract from the article.