Apache is installed by default on macOS but it's not configured to automatically start during system boot. For this you'll have to manually start the httpd process every time you want to use it.

user@host $ sudo apachectl -k start
AH00112: Warning: DocumentRoot [/usr/docs/dummy-host.example.com] does not exist
AH00112: Warning: DocumentRoot [/usr/docs/dummy-host2.example.com] does not exist

It's a good default setting as the majority of macOS user will not need a web server running all the time in the background, but if you're a web developer for example, you might want Apache to automatically start whenever macOS boots up.

Steps to automatically start Apache during macOS startup:

  1. Launch Terminal application.
  2. Use launchctl to automatically load Apache's startup script during system boot.
    $ sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
  3. Start httpd process manually to use Apache immediately.
    $ sudo apachectl -k start
  4. Disable Apache from automatically starting up during system boot when no longer necessary.
    $ sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 
Discuss the article:

Comment anonymously. Login not required.