Homebrew Does Not Completely Uninstall Nginx

I installed yesterday nginx on my machine using

brew install nginx

Today I would like to remove the software, therefore I tried

brew uninstall nginx

which has been correctely executed. In fact if I ask again to uninstall nginx I get

Error: No such keg: /usr/local/Cellar/nginx

The problem is that the files under

/usr/local/etc/nginx

has not been removed.

What is the correct way to remove them?
Thank you

4

5 Answers

As usual, use

rm -f -R /usr/local/nginx
rm -f /usr/local/sbin/nginx

from terminal,

  1. uninstall nginx using: brew remove nginx

  2. remove nginx config files using: rm -r /usr/local/var/run/nginx

November 2017 – El Capitan

It seems the answers are outdated.  After trying a lot of options, I've finally found the right instructions:

remove from brew:

brew remove nginx

remove config:

The folder was changing; make sure the folder exists.  If it does not exist, it's because brew could change for the future versions (I hope not).  In this case, tell me to update my answer.

rm -f -R /usr/local/etc/nginx  
2

I found an nginx directory in all these places mentioned above. This is a succinct list of all the commands above:

brew remove nginx
rm -f -R /usr/local/nginx
rm -f /usr/local/sbin/nginx
rm -r /usr/local/var/run/nginx
rm -f -R /usr/local/etc/nginx  
rm -r /usr/local/opt/nginx

I got the same error but nginx was installed in /usr/local/opt/. To resolve I did:

rm -r /usr/local/opt/nginx
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest