Running Apache locally keeps development sites, reverse proxies, and test endpoints available immediately after a reboot, instead of requiring a manual server start whenever macOS restarts.
The Apple-bundled Apache httpd is controlled by apachectl, which starts /usr/sbin/httpd using configuration under /etc/apache2 and (by default) serves content from /Library/WebServer/Documents. Boot-time startup is managed by launchd, which loads daemon definitions from LaunchDaemons property lists (.plist) such as /System/Library/LaunchDaemons/org.apache.httpd.plist under the label org.apache.httpd.
Administrator privileges are required because httpd runs as a system daemon and typically binds privileged ports. A broken configuration (for example in /etc/apache2/httpd.conf or an included vhost file) prevents startup and can generate repeated start attempts and log noise. These steps target the Apple-provided Apache; a Homebrew-installed httpd uses a different binary path and a different service-management workflow.
Related: How to test your Apache configuration
Related: How to enable or disable Apache modules
Steps to configure automatic Apache startup on macOS:
- Open Terminal.
- Validate the active Apache configuration before enabling automatic startup.
$ sudo apachectl configtest Syntax OK
A syntax error can prevent boot-time startup and trigger repeated restart attempts.
- Start Apache once to confirm the current configuration can run.
$ sudo apachectl start
- Confirm the local server responds on localhost.
$ curl -I http://localhost/ HTTP/1.1 200 OK Date: Sat, 13 Dec 2025 12:34:56 GMT Server: Apache/2.4.57 (Unix) Content-Type: text/html; charset=UTF-8 ##### snipped #####
A port conflict typically shows up as a start failure and a missing response from http://localhost/.
- Bootstrap the built-in launchd job definition for Apache.
$ sudo launchctl bootstrap system /System/Library/LaunchDaemons/org.apache.httpd.plist
No output is a common success case.
- Enable the Apache job so it starts automatically at boot.
$ sudo launchctl enable system/org.apache.httpd
- Start the Apache job immediately under launchd supervision.
$ sudo launchctl kickstart -k system/org.apache.httpd
The kickstart -k option terminates any existing instance before starting a fresh one.
- Verify launchd reports the job as running.
$ sudo launchctl print system/org.apache.httpd org.apache.httpd = { state = running pid = 161 ##### snipped ##### } - Confirm the job is enabled for boot-time startup.
$ sudo launchctl print-disabled system { "org.apache.httpd" => false ##### snipped ##### }false indicates the job is not disabled in the system domain.
- Disable automatic startup if it is no longer required.
$ sudo launchctl disable system/org.apache.httpd
- Unload the system Apache job from launchd to stop it immediately.
$ sudo launchctl bootout system /System/Library/LaunchDaemons/org.apache.httpd.plist
Unloading stops httpd and makes local sites unavailable until Apache is started again.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
Comment anonymously. Login not required.
