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.
[email protected] $ 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.
Apacheconfiguration is valid.
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
httpdprocess successfully run.
ps -aef | grep httpd 0 161 1 0 Sun04AM ?? 0:04.05 /usr/sbin/httpd -D FOREGROUND 501 800 161 0 Sun04AM ?? 0:02.54 /usr/sbin/httpd -D FOREGROUND 501 1007 161 0 Sun04AM ?? 0:02.62 /usr/sbin/httpd -D FOREGROUND 501 1381 161 0 Sun07AM ?? 0:01.71 /usr/sbin/httpd -D FOREGROUND 501 4472 161 0 Tue07AM ?? 0:01.74 /usr/sbin/httpd -D FOREGROUND 501 4473 161 0 Tue07AM ?? 0:01.17 /usr/sbin/httpd -D FOREGROUND 501 4474 161 0 Tue07AM ?? 0:01.06 /usr/sbin/httpd -D FOREGROUND
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.