After upgrading to a newer MacOS version, I suddenly experienced that sudo apachectl graceful started giving the following error message:

Could not reliably determine the server's fully qualified domain name

The problem

The problem turned out to be that I had previously installed a newer version of apache using brew, and the system was still using that apachectl file.

Running which apachectl gave the following path:


And running ls -la /usr/local/bin revealed that apachectl was mapped to an httpd package, that I had installed using homebrew:

lrwxr-xr-x   Mar  2 22:40 apachectl -> ../Cellar/httpd/2.4.29_1/bin/apachectl

The solution

The solution in my case was to unlink the “httpd” package that I had installed using Homebrev, since I’m now using the built-in apache that comes with Mac OS.

In other words, I executed the following command: brew unlink httpd

After that, running which apachectl gives the following path:


How to fix that apachectl gives error “Could not reliably determine the server’s fully qualified domain name”