On this page
MacBook computer and Apache Server logo on it.

macOS – find, start, stop, and restart the Apache web server

Discover macOS commands to manage Apache web server: find, start, stop, and restart for default and Homebrew installations.

Trying to find out if the Apache server is running on macOS? How to find it? And once you find it, why are there several methods to start, stop and restart it? You may feel lost. Let’s sort this out.

Determine which Apache server is currently being used on macOS

To determine which Apache server is currently being used on macOS via the terminal, you can use several methods:

Check running Apache processes

Use the command ps aux | grep httpd to list all processes related to Apache. This command displays only processes with the command line httpd, which is the name of the Apache HTTP server. This function helps you determine whether Apache is operating and can provide information about the version or configuration being used.

Example output from ps aux | grep httpd
john          4479   0.0  0.0 35082484  25020   ??  S     9:56PM   0:00.09 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
john          4475   0.0  0.0 34928884  25016   ??  S     9:56PM   0:00.10 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
john          4468   0.0  0.0 35069172  24884   ??  S     9:56PM   0:00.06 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
john          4460   0.0  0.0 35202800  31464   ??  S     9:56PM   0:00.17 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
john          4449   0.0  0.0 34949872  31936   ??  S     9:56PM   0:00.18 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
john          4441   0.0  0.0 35191536  31060   ??  S     9:56PM   0:00.17 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
john          4376   0.0  0.0 35061488  31396   ??  S     9:55PM   0:00.17 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
john          4298   0.0  0.1 35193584  34732   ??  S     9:54PM   0:00.27 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
john          4248   0.0  0.1 35212016  34044   ??  S     9:54PM   0:00.29 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
john          4180   0.0  0.1 35335920  35340   ??  S     9:52PM   0:00.37 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
john          3357   0.0  0.0 34917284  19792   ??  S     9:22PM   0:01.55 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
john          9144   0.0  0.0 34261584    792 s000  S+   10:59AM   0:00.01 grep httpd

Using which and whereis commands

The which -a httpd command shows all instances of httpd in your system’s PATH. The whereis httpd command locates the binary, source, and manual page files for httpd.

Example output from which -a httpd and whereis httpd
$ which -a httpd               

$ whereis httpd
httpd: /usr/sbin/httpd /usr/local/share/man/man8/httpd.8

Check Apache configuration

If you have multiple Apache installations, you can check their configuration files to see which one is being used. The default Apache configuration file on macOS is typically located at /etc/apache2/httpd.conf, while a Homebrew-installed Apache might have its configuration files in /usr/local/etc/httpd/. Comparing these files can help you determine which Apache server is currently active.

You can check which configuration file Apache is using by looking at the output of apachectl -t -D DUMP_INCLUDES.

Example output from apachectl -t -D DUMP_INCLUDES
Included configuration files:
  (*) /usr/local/etc/httpd/httpd.conf
    (511) /usr/local/etc/httpd/extra/httpd-vhosts.conf
    (528) /usr/local/etc/httpd/extra/httpd-ssl.conf

By using these commands, you can identify which version of Apache is currently running on your macOS system, whether it’s the default version provided by Apple or a version installed via Homebrew or another method.

Internal Apache

Let’s look into internal, built-in the macOS, Apache details and commands.

  • Binary: /usr/sbin/httpd
  • Start Apache web server: sudo /usr/sbin/apachectl start
  • Stop Apache web server: sudo /usr/sbin/apachectl stop
  • Forcefully stop Apache and unload it from launch control: sudo killall httpd && sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist
  • Reload Apache after editing the config file: sudo apachectl graceful.

    This graceful command is equivalent to a restart but waits for no open connections to be broken, making it a more graceful way to reload the configuration. It’s important to note that while the reload command is often used to apply changes without dropping existing connections, it technically performs a restart of the Apache server. The method it does so minimizes interference with ongoing connections, which is where it differs. This is especially helpful in production settings when it’s important to minimize downtime.

  • Determine version: /usr/sbin/apachectl -v. Example output:

    Example output from /usr/sbin/apachectl -v
    Server version: Apache/2.4.58 (Unix)
    Server built:   Feb 10 2024 01:12:11
  • The config: Usually /etc/apache2/httpd.conf, but you can run /usr/sbin/apachectl -t -D DUMP_INCLUDES to determine exact path.

    Example output from /usr/sbin/apachectl -t -D DUMP_INCLUDES
    Included configuration files:
      (*) /private/etc/apache2/httpd.conf
        (509) /private/etc/apache2/extra/httpd-mpm.conf
        (515) /private/etc/apache2/extra/httpd-autoindex.conf
        (555) /private/etc/apache2/other/mpm.conf
        (555) /private/etc/apache2/other/php7.conf

    Note that /private/etc/apache2 is another location where the httpd.conf file can be found, and /etc is a symbolic link to this directory.

Homebrew Apache

Let’s look into Homebrew’s Apache version details and commands.

  • Binary: /usr/local/bin/httpd
  • Start Apache: brew services start httpd
  • Stop Apache: brew services stop httpd
  • Restart Apache: brew services restart httpd

    Example output from brew services restart httpd
    Stopping `httpd` (might take a while)
    ==> Successfully stopped `httpd` (label: homebrew.mxcl.httpd)
    ==> Successfully started `httpd` (label: homebrew.mxcl.httpd)
  • Determine version: /usr/local/bin/apachectl -v. Example output:

    Example output from /usr/sbin/apachectl -v
    Server version: Apache/2.4.59 (Unix)
    Server built:   Apr  3 2024 12:22:45
  • The config: Usually /usr/local/etc/httpd/httpd.conf, but you can run /usr/local/bin/apachectl -t -D DUMP_INCLUDES to determine exact path.

    Example output from /usr/local/bin/apachectl -t -D DUMP_INCLUDES
    Included configuration files:
      (*) /usr/local/etc/httpd/httpd.conf
        (511) /usr/local/etc/httpd/extra/httpd-vhosts.conf
        (528) /usr/local/etc/httpd/extra/httpd-ssl.conf

Conflict between internal Apache and Apache installed via Homebrew

To resolve the conflict between the internal Apache server provided by macOS and the Apache server installed via Homebrew, you can stop internal Apache and prevent from auto-starting.

How to stop and prevent auto-starting the internal Apache server on macOS

To stop the internal Apache server on a Mac, including preventing the Apache server from auto-starting again when you restart your Mac, you can use the following commands in the Terminal:

  • Find internal version: Use command which -a apachectl. The default location for internal Apple Apache server is /usr/sbin/apachectl.
  • Stop internal Apache: sudo /usr/sbin/apachectl stop or sudo apachectl stop
  • Preventing the Apache server from auto-starting: sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null. The -w argument in the command is crucial to prevent the Apache job from loading after macOS restarts.

apachectl vs httpd

The last thing to clarify is the difference between apachectl and httpd.

When it comes to managing and controlling the Apache HTTP Server, two commonly used commands are apachectl and httpd. These commands serve similar purposes but have some differences in their functionality and usage.


apachectl is a command-line utility that provides a convenient interface for controlling the Apache HTTP Server. It is often used for starting, stopping, and restarting the server, as well as performing other administrative tasks.


On the other hand, httpd is the actual executable file for the Apache HTTP Server. It is the program that runs as the server daemon and handles incoming HTTP requests.

While httpd can be used directly to start, stop, and restart the server, it does not provide the additional functionality and convenience that apachectl offers. However, it can be used as a synonym for certain apachectl options, such as httpd -S being equivalent to apachectl -D DUMP_VHOSTS.

Although the httpd command may function as intended on the Apache server, depending on the OS and Apache’s architecture, the apachectl command is the recommended way to start Apache V2.0 and higher.

Related posts


Leave a Reply

Real-user monitoring for Accessibility, Performance, Security, SEO & Errors (SiteLint)