Using brew update, brew upgrade, and brew cleanup when installing, uninstalling and updating packages

I was told by one guy that it is best to use brew update, brew upgrade and brew cleanup as often as possible. That is, that …

  • … the most safe and clean way to install a package is

    brew update
    brew upgrade
    brew install foo
    brew cleanup
  • … the most safe and clean way to uninstall a package is

    brew update
    brew upgrade
    brew uninstall --ignore-dependencies foo
    brew cleanup
  • and the most safe and clean way to update a package is

    brew update
    brew upgrade foo
    brew cleanup

Is it really so?


Faaaaaar from a terminal champ, but when I use homebrew packages I generally throw brew doctor as a last command to identify any issues.

1 Like

You can do this but I’ve never bothered. I do now brew auto updates unless you set an environment variable prior to most commands.

I periodically run brew upgrade but I’ve never had an issue that necessitated running it or cleanup.

Maybe once a year I rediscover the remove unused flag and clean that up

Been doing that for a long time, nothing seems to have been broken. Still I am not a heavy homebrew user.

Doesn’t adding --ignore-dependencies make the uninstallation less safe?

(breaking packages that depend on this one?)

Why you would upgrade other packages before uninstalling a specific one?

I’m not sure what qualifies as heavy user :grin: but I try whenever possible to install through homebrew so I can use GitHub - Homebrew/homebrew-bundle: 📦 Bundler for non-Ruby dependencies from Homebrew, Homebrew Cask and the Mac App Store. to manage which apps, scripts, libraries, and packages to install on a fresh machine. Even still, I’ve issues maybe once? and reinstalling the offending package fixed it


Well I only install something via homebrew when it’s strictly developer-related, perhaps once a month. Casks are not my cup of tea.

Thanks for bringing this to my attention, mas-cli looks really useful! I already try to install non App Store software via homebrew when possible and adding the Mac App Store to the shell script will make life that much easier.

Another tool to manage Homebrew installs is Cork. It is now 25€ for a precompiled version (it has been both more and less expensive in the past) or free if you compile it yourself.

1 Like

For packages like Logitech Options+, which are big and clunky and come with their own separate uninstallers residing in Launchpad, does this advice still hold? Does Homebrew intelligently (or due to the devs hardcoding it in) launch the uninstaller instead of uninstalling the usual way?

Does the demo version work for anyone? (For me it gets stuck with spinners)

EDIT: building it myself does work…

1 Like

I make use of homebrew regularly to install later or GNU versions of UNIX tools that are old or too BSDish on macOS. For example I much prefer the GNU version of sed to the version that ships as a standard component of macOS. Updating a tool such as sqlite3 (the command line shell) to the latest release with recent bug fixes is essential for work on a canvassing database for a local political party.

My one major gripe with homebrew is that some homebrew programs are added to /opt/homebrew/opt/bin (via a link) and be be used as an immediate alternative or from new such as algol68g because that folder is in PATH but others, including sqlite3, are not but require explict changes to PATH.