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 Password: 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:
launchctlto automatically load
Apache's startup script during system boot.
$ sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist Password:
httpdprocess manually to use
$ sudo apachectl -k start
Apachefrom automatically starting up during system boot when no longer necessary.
$ sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
Comment anonymously. Login not required.