Brew services start httpd

Typing above service does NOT start apache as so many like wish it to be. Therefore there are many inddiciduals – like me – who still keep typing “sudo apachectl start” in order to get apache running.

The reason why brew’s httpd service does not start apache is, because brew’s httpd – to be found in /usr/local/opt/httpd/bin/ httpd – needs sudo privileges. This can be verified by running this command:

sudo brew services start apache2

Some warnings in the terminal output teach us a bit more.

However, I wonder, what the reason for using sudo is? And if there are plans to make it work with simple login privileges so that httpd can act like any other service? Or if I have to “fix” my mindset to get things running properly?

Any hint to a resource, where this httpd speciffic behavior is described, would be most welcome – my search was not particularly successful so far.

Thank you!


I just ran

brew install httpd
brew services start httpd
curl http://localhost:8080

And it worked as expected. I’m not sure where you see the sudo requirement. Cause that isn’t in the source you linked either.

@rowild, if you changed the listening port in httpd.conf to 80, 443, or any value under 1024, every Unix-based OS requires you to start httpd as root.1 This is not a Homebrew bug, rather a system requirement for every process listening on a privileged (i.e. low-numbered) port.

1 Or with an OS-specific elevated privilege, like Linux’s CAP_NET_BIND_SERVICE capability. I think the equivalent in macOS is to split the program into launchd-aware privileged/non-privileged portions, but good luck trying to persuade the Apache project to rearchitect httpd this way.