skip to Main Content

I have a problem with Apache on Mac OS Big Sur. After the OS update, the Apache (using Brew) doesn’t work anymore.
So I have decided to uninstalled the httpd Formula.
Then tested is the preinstalled version of Apache works and it does.

  1. So I have stopped the preinstalled Apache sudo apachectl stop
  2. Unloaded launcher sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
  3. Updated the Homebrew
    • brew update
    • brew doctor
    • brew upgrade
  4. Installed the httpd again brew install httpd (installed successfully)
  5. Started the httpd sudo brew services start httpd

However checking the status sudo brew services list I can see that the httpd service has status error.
When I try to start apache using sudo apachectl start I’m receiving the error:

(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:8080
no listening sockets available, shutting down
AH00015: Unable to open logs

I’ve checked if maybe there is something else running on the 8080 port lsof -i TCP:8080 but it’s not.

I’ve checked which Apache is used (which apachectl) and it seems to be the right one (/usr/local/bin/apachectl)

No matter what port I’m trying to use, always there is an error that the address is already in use.

Does anyone has any idea how to fix this problem?

4

Answers


  1. I was facing the same problem.
    It appears that bindings to INADDR_ANY (0.0.0.0) fail.

    To circumvent the bind error, I changed in /usr/local/etc/httpd/httpd.conf the following line:

    Listen 8080
    

    to:

    Listen 127.0.0.1:8080
    

    Afterwards, I could start apache without the bind error, using the following command:

    sudo apachectl -k start
    
    Login or Signup to reply.
  2. I’ve also been facing this issue after my Mac was restarted (after a week of already using Big Sur). I had to completely uninstall the httpd from Brew, kill all the processes using port 80, re-install the httpd, changing the httpd.conf as Frank mentioned, and only then I could get it working (without the need for sudo). :

    So in short, first change this line in httpd.conf to:

    Listen localhost:80

    And then here is the list of command I ran:

    brew uninstall httpd
    kill $(lsof -ti:80)
    brew install httpd
    

    If the service is not running. You can do: brew services start http

    Or: /usr/local/opt/httpd/bin/httpd -k start

    Please note, I already had a working system before this. For the full installation guidelines follow the amazing tutorial on getgrav. They deserve a lot of credit for such a complete tutorial and their support in the comments there!

    P.S: Here is why you shouldn’t use sudo to start httpd.

    Login or Signup to reply.
  3. I had the same problem, but needed to run apache on port 80. First I got it working on 8080 with the solution above by @FrankStappers with:

    Listen 127.0.0.1:8080
    ServerName localhost:8080
    

    Next I tried changing the port to 80 in both Listen and ServerName directives. Restarting left me with these errors:

    (13)Permission denied: AH00072: make_sock: could not bind to address 127.0.0.1:80
    no listening sockets available, shutting down
    AH00015: Unable to open logs
    

    Ultimately changing Listen and ServerName as follows fixed it:

    Listen 0.0.0.0:80
    ServerName localhost
    

    The solution is documented in the Troubleshooting Non-Sudo httpd Services Start section of https://getgrav.org/blog/macos-bigsur-apache-multiple-php-versions

    Login or Signup to reply.
  4. My solution:

    1. brew services stop httpd
    2. Edit your httpd.conf maybe located in /usr/local/etc/httpd/httpd.conf
    Listen 80
    ServerName localhost
    
    1. Make sure there are no other lines with this keys and save the file.
    2. brew services start httpd
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search