It looks like the issue is now solved using an external command called or brew rmdeps.brew rmtree
To install and use, issue the following commands:
$ brew tap beeftornado/rmtree
$ brew rmtree <package>
See the above link for more information and discussion.
[EDIT] see the new command in https://stackoverflow.com/a/66719581/160968brew autoremove
It appears that currently, there's no easy way to accomplish this.
However, I filed an issue on Homebrew's GitHub page, and somebody suggested a temporary solution until they add an exclusive command to solve this.
There's an external command called which prints all packages that are not dependencies of other packages.brew leaves
If you do a logical and on the output of and brew leaves, you might just get a list of the orphaned dependency packages, which you can uninstall manually afterwards. Combine this with brew deps <package> and you'll get what you need, I guess (untested, don't count on this).xargs
EDIT: Somebody just suggested a very similar solution, using instead of join:xargs
brew rm FORMULA
brew rm $(join <(brew leaves) <(brew deps FORMULA))
See the comment on the issue mentioned above for more info.
They provide an official uninstall script you can download and run:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Homebrew once recommended an older script, also linked in their FAQ.
Here is a copy of the old script, for historical purposes:
cd `brew --prefix`
git checkout master
git ls-files -z | pbcopy
rm -rf Cellar
bin/brew prune
pbpaste | xargs -0 rm
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
test -d Library/LinkedKegs && rm -r Library/LinkedKegs
rmdir -p bin Library share/man/man1 2> /dev/null
rm -rf .git
rm -rf ~/Library/Caches/Homebrew
rm -rf ~/Library/Logs/Homebrew
rm -rf /Library/Caches/Homebrew
This should also revert your folder to its pre-Homebrew days. See the Homebrew installation wiki for more information./usr/local
Note: You may also need to remove as well. If you happen to have ~/.homebrew, then you should delete ~/.rvm. If any of your brew package had brew services that are running, you should turn them off. If any packages installed their own libraries (like Python's pip) you'll have to uninstall those manually.~/.rvm/bin/brew
Homebrew packages can be uninstalled with
brew uninstall PACKAGE-NAME
Homebrew can‘t know which packages you don‘t need anymore, you have to decide yourself.
This will not ask if you are sure when you delete, so be sure the rm -rf command works to get you out of /tmp (the cd gets you to a safe place in case you copy/paste everything in one go so you don't delete files from your current directory)cd /tmp
Try this in your Terminal:
cd /tmp
cd `brew --prefix`
rm -rf Cellar
brew prune
rm `git ls-files`
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
rm -rf .git
rm -rf ~/Library/Caches/Homebrew
More info about this topic can be found in the Homebrew FAQ.
To remove using python, you will need to first uninstall the dependencies indicated, i.e. execute:brew
brew uninstall libxmlsec1 && brew uninstall libxml2
After that, you should be able to uninstall using python as you tried originally.brew uninstall python
You could use the suggestion from the error message, , however the dependencies would remain installed but would not function, which may cause further problems down the line.brew uninstall --ignore-dependencies python
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.