From ece12aac76f28ead91a71738f2b2e17f6011248e Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Thu, 23 Oct 2025 14:23:11 -0500 Subject: [PATCH] Add Clean Up Your Brew Installations as a Brew TIL --- README.md | 3 +- brew/clean-up-your-brew-installations.md | 40 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 brew/clean-up-your-brew-installations.md diff --git a/README.md b/README.md index ab91395..755eb34 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186). -_1664 TILs and counting..._ +_1665 TILs and counting..._ See some of the other learning resources I work on: @@ -125,6 +125,7 @@ If you've learned something here, support my efforts writing daily TILs by ### Brew +- [Clean Up Your Brew Installations](brew/clean-up-your-brew-installations.md) - [Configure Brew Environment Variables](brew/configure-brew-environment-variables.md) - [Export List Of Everything Installed By Brew](brew/export-list-of-everything-installed-by-brew.md) - [List All Services Managed By Brew](brew/list-all-services-managed-by-brew.md) diff --git a/brew/clean-up-your-brew-installations.md b/brew/clean-up-your-brew-installations.md new file mode 100644 index 0000000..ffe3b2a --- /dev/null +++ b/brew/clean-up-your-brew-installations.md @@ -0,0 +1,40 @@ +# Clean Up Your Brew Installations + +Over time as you upgrade brew-installed programs and make changes to your +`Brewfile`, your machine will have artifacts left behind that you no longer +need. + +Periodically, it is good to clean things up. + +First, you can get a summary of stale and outdated files that brew has +installed. Use the `--dry-run` flag. + +```bash +$ brew cleanup --dry-run +``` + +If you feel good about what you see in the output, then give things a clean. + +```bash +$ brew cleanup +``` + +Second, if you are using a `Brewfile` to manage what `brew` installs, then you +can instruct `brew` to uninstall any dependencies that aren't specified in that +file. + +By default it operates as a dry run and the `--force` flag will be needed to +actually do the cleanup. And specify the filename if it doesn't match the +default of `Brewfile`. + +```bash +$ brew bundle cleanup --file=Brewfile.personal +``` + +If the output looks good, then force the cleanup: + +```bash +$ brew bundle cleanup --force --file=Brewfile.personal +``` + +See `brew cleanup --help` and `brew bundle --help` for more details.