Remove homebrew apache2 fails

apachehomebrewwebserver

On a new Macbook Pro, I installed apache2 with homebrew, but now want to switch back to native apache2 server.

I removed the homebrew package with:

brew uninstall apache2

I also removed any homebrew launch links from these directories:

ls /Library/LaunchAgents/ /Library/LaunchDaemons/ ~/Library/LaunchAgents/
/Library/LaunchAgents/:
com.microsoft.update.agent.plist     
com.teamviewer.teamviewer.plist      
com.teamviewer.teamviewer_desktop.plist
/Library/LaunchDaemons/:
com.microsoft.OneDriveUpdaterDaemon.plist    
com.teamviewer.Helper.plist
com.microsoft.autoupdate.helper.plist        
com.teamviewer.teamviewer_service.plist
com.microsoft.office.licensingV2.helper.plist
/Users/jd/Library/LaunchAgents/:
com.google.keystone.agent.plist com.jetbrains.toolbox.plist

But even after reboot, I believe Homebrew apache is still running:

sudo /usr/sbin/apachectl 
Password:
httpd: Syntax error on line 67 of /private/etc/apache2/httpd.conf: Cannot load lib/httpd/modules/mod_mpm_prefork.so into server: dlopen(/Users/jd/projects/lib/httpd/modules/mod_mpm_prefork.so, 10): image not found

This module is referenced from /usr/local/etc/httpd/httpd.conf, which I believe is homebrew. Instead the configuration I want apache to use is in /etc/apache2/httpd.conf

Best Answer

This was fully my fault because of a misconfiguration. I had inadvertently changed ServerRoot, causing it to look for the configuration files in the wrong folder.

Homebrew apache2 was actually fully removed

This linked answer https://apple.stackexchange.com/a/270848/132798 helped me to figure this out