If you are a Mac owner and a serious *NIX user, you’re probably aware of Homebrew.
I have a few of my favorite tools installed with brew and I like to keep my “Cellar” clean and up-to-date. Here’s my commonly used commands and my typical workflow.
Never forget about man’s best friend – “man”. Use man to get the list of commands and options that can be used with brew:
1 |
man brew |
To list software you currently have installed with version numbers, use:
1 |
brew list --versions |
To see just the software, which is not a dependency of another:
1 |
brew leaves |
To keep the Homebrew itself up-to-date, and fetch the newest version from GitHub:
1 |
brew update |
After updating the brew, check which formulae have an updated version available, display detailed version information to see if you have more than one older version laying around:
1 |
brew outdated --verbose |
See any app that you no longer need and want to get rid of them? Check the dependencies for all installed formulae:
1 |
brew deps --installed |
For even more detailed picture, show the dependencies for all installed formulae as a tree:
1 |
brew deps --installed --tree |
As a final precaution before removing a formula, see what other installed formulae use it as a dependency:
1 |
brew uses --installed formula |
Uninstall formulae and all their older versions:
1 |
brew remove --force formulae |
Upgrade remaining formulae:
1 |
brew upgrade |
Show what will be removed by cleanup command, but do not actually remove anything:
1 |
brew cleanup -ns |
Clean the “Cellar” removing any older versions of installed formulae and clearing old downloads from the Homebrew download-cache. Additionally, scrub the cache, removing downloads for even the latest versions of formula, which are downloaded, but not installed:
1 |
brew cleanup -s |