How does one remove all the unused dependencies hanging around? I have no idea. If you want to remove a particular package and all it’s unused dependencies, you could use brew rmtree.
Yesterday, I used something different: First, I used `brew leaves` to create a list of stuff that isn’t a dependency for anything else I have installed. Then I edited this list down to the stuff I wanted to keep and ran brew_clean on it.
This removed a lot of packages, but also resulted in many messages like these:
Uninstalling /usr/local/Cellar/glibmm/2.46.3... (1,674 files, 43.6M) glibmm 2.40.0, 2.42.0, 2.44.0 are still installed. Remove them all with `brew uninstall --force glibmm`.
So I had to go through the output and manually uninstall the older versions.
$ brew uninstall --force glibmm Uninstalling glibmm... (4,832 files, 113.4M)
I didn’t know brew was keeping so many old versions around! I should have used brew cleanup.
Just to be sure, I ran it.
$ brew cleanup ... ==> This operation has freed approximately 6.8G of disk space.
Wow! I don’t think I ran this, ever.
I had a few messages saying that I had not installed the latest version:
Warning: Skipping homebrew/dupes/rsync: most recent version 3.1.2 not installed
I ran `brew upgrade` followed it by another `brew clean`.
==> This operation has freed approximately 5.6G of disk space.
This is amazing.
My take away:
1. check the output of `brew leaves` and delete packages you no longer care about
2. install `brew rmtree` and use it when deleting packages in order to delete former dependencies
3. run `brew cleanup` every now and then to delete old versions
#Homebrew
(Please contact me if you want to remove your comment.)
⁂
Another one to free some space:
alex@Megabombus:~$ brew cask cleanup ==> Removing cached downloads /Users/alex/Library/Caches/Homebrew/Cask/avidemux--2.6.12.dmg /Users/alex/Library/Caches/Homebrew/Cask/mactex--20160603.pkg ==> This operation has freed approximately 2.8G of disk space.
– Alex Schroeder 2016-10-15 14:15 UTC