Sergey Lyskov
Sergey Lyskov

Reputation: 23

How can I install brew httpd on MacOS 11 Big Sur?

I've upgraded macOS version to 11 Big Sur and unable to use brew's apache instead of build in version.

What I did:

sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null

brew intall httpd

When I'm trying to start the installed httpd it says that apache is started

==> Successfully started httpd (label: homebrew.mxcl.httpd)

but when I run brew services command I see that httpd is not started (and http://localhost:8080 is not working).

sergeylyskov@MacBook-Pro-Sergey ~ % brew services            
Name          Status  User         Plist
httpd         error   sergeylyskov /Users/sergeylyskov/Library/LaunchAgents/homebrew.mxcl.httpd.plist
[email protected]       stopped              
[email protected]       stopped              
postgresql@12 stopped              

P.S. I want to use brew's version because seems like build in apache is not properly work with php modules (it don't show xdebug and imagick extensions in phpinfo())

Any advice?

Upvotes: 2

Views: 3835

Answers (1)

Magnus
Magnus

Reputation: 3722

I tried uninstalling and then reinstalling httpd, but that didn't work initially. When you uninstall, brew does NOT remove the /usr/local/etc/httpd config directory (which is sensible because you might have a lot of things configured in there and not backed up). However, these configuration files might well be outdated (or customized) in a way that makes them incompatible with the latest version of httpd, causing it to fail. So I did the following:

brew services stop httpd
brew uninstall httpd
mv /usr/local/etc/httpd /usr/local/etc/httpd-old
brew install httpd 
brew services start httpd

This got it running again with fresh config files; I can now copy over any specific configuration details from httpd-old into the new httpd dir.

Also note: by default, httpd serves from /usr/local/var/www. This dir is not affected by the uninstall-reinstall process, so only your config files need re-doing.

Upvotes: 1

Related Questions