Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to completely uninstall Homebrew Apache httpd24?

On macOS Sierra, I installed Apache using Homebrew:

$ brew install httpd24

This has caused some weird Apache issues. It seems that the default installation of Apache on macOS Sierra was still active in some way. I now want to completely uninstall httpd24 but am still seeing it in my processes. Here's what I did:

$ brew unlink httpd24 $ brew uninstall httpd24 $ rm -rf /usr/local/etc/apache2/

Running $ ps aux|grep httpd reveals:

blt              51473   0.0  0.0  2613988    844   ??  S    10:48PM   0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt              51447   0.0  0.0  2613988    892   ??  S    10:47PM   0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt              51396   0.0  0.0  2613988    856   ??  S    10:47PM   0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt              51345   0.0  0.0  2613988    844   ??  S    10:47PM   0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt              51285   0.0  0.0  2613988    876   ??  S    10:45PM   0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt              51048   0.0  0.0  2615200    868   ??  S    10:34PM   0:00.00 /usr/sbin/httpd -T
blt              51047   0.0  0.0  2615200    840   ??  S    10:34PM   0:00.00 /usr/sbin/httpd -T
blt              51046   0.0  0.1  2628716  20104   ??  S    10:34PM   0:00.06 /usr/sbin/httpd -T
blt              51045   0.0  0.1  2628716  20084   ??  S    10:34PM   0:00.05 /usr/sbin/httpd -T
blt              51044   0.0  0.1  2628716  20148   ??  S    10:34PM   0:00.04 /usr/sbin/httpd -T
blt              51043   0.0  0.1  2628716  20236   ??  S    10:34PM   0:00.05 /usr/sbin/httpd -T
blt              51041   0.0  0.1  2628716  20668   ??  S    10:34PM   0:00.07 /usr/sbin/httpd -T
blt              51040   0.0  0.4  2644668  59852   ??  S    10:34PM   0:01.05 /usr/sbin/httpd -T
root             47136   0.0  0.1  2615456  18872   ??  Ss    5:34PM   0:00.67 /usr/sbin/httpd -T
root             43442   0.0  0.0  2614244   7172   ??  Ss    4:14PM   0:00.83 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt              52451   0.0  0.0  2423384    256 s003  R+   11:06PM   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn httpd

The processes with the path /usr/sbin/httpd are the default Apache installation. The ones with the path /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd is the Homebrew installation. This shouldn't even be possible. The directory /usr/local/Cellar/httpd24 doesn't even exist. I have tried manually killing those processes but they eventually come back. I have tried restarting my computer. I have restarted Apache countless times. I have confirmed that the Apache I am interacting with on the command line using $ apachectl is the default installation. I don't know what else to do. Thank you for any help.

like image 747
maskedjellybean Avatar asked Dec 16 '16 07:12

maskedjellybean


1 Answers

I can't remember what exactly I did to resolve this, but I've pieced together a bash alias that might be useful to other people who are using Homebrew PHP but the default Mac OS Apache. It will stop Apache, kill any Homebrew Apache (httpd24) processes, unlink and uninstall Homebrew Apache and restart the remaining default Apache installation. Occasionally I have to use this after installing a new PHP version using Homebrew. See this issue for more information: https://github.com/Homebrew/homebrew-php/issues/3601

alias fix_apache='sudo apachectl stop; sudo pkill -f /usr/local/Cellar/httpd24; sudo pkill -f /usr/sbin/httpd; sudo pkill -f /usr/local/opt/httpd24; brew unlink httpd24; brew uninstall --ignore-dependencies --force httpd24; sudo apachectl start;'
like image 135
maskedjellybean Avatar answered Nov 01 '22 02:11

maskedjellybean