MacOS – How to completely remove homebrew

homebrewmacos

I am seeking for the equivalent of

rvm implode

In the Ruby rvm world rvm implode completely uninstalls everything ruby related installed via rvm, including rvm too.

Is there anything similar for homebrew? Or do I have to remove each package, then remove /usr/local/Cellar and look around for any other remains that have not been dealt with automatically?

Best Answer

Use this script to uninstall homebrew completely. It's safer to run each command separately, especially the cd `brew --prefix` to check if it suceeds.

From the homebrew FAQ:

How do I uninstall Homebrew?

If you installed to /usr/local then you can use the script in this gist to uninstall — it will only remove Homebrew and the stuff Homebrew installed leaving anything else in /usr/local alone.

Provided you haven’t put anything else in Homebrew’s prefix (brew --prefix), you can generally just rm -rf that directory. This is because Homebrew won’t touch files outside its prefix.