Upgrade ALL your Brew packages

Having slipped down the rabbit hole of attempting to install every application onto my mac using terminal via Homebrew or mas, I am now faced with the question of how do I update those applications?

Upgrade ALL your Brew packages

Having slipped down the rabbit hole of attempting to install every application onto my mac using terminal via Homebrew or mas, I am now faced with the question of how do I update all of those applications via brew?

Solution

brew update && brew list --casks | xargs brew install --cask && brew cleanup

source derived from: https://gist.github.com/mikker/631106/450...

Caveat

Some packages cause this process to error. For example,
Error: onedrive: Unsatisfied requirements failed this build.
or
Error: Cask 'autodesk-fusion360' is not installed.
Fusion360 regularly throws this error, the process stops and... therefore the command is not fully executed, not all applications get examined for update and the all important brew cleanup is skipped.

Solution

It is possible to exclude specific packages from examination with grep -v 'package'

brew update && brew list --casks | grep -v 'autodesk-fusion360' | xargs brew upgrade --cask && brew cleanup

Usual dislaimer, execute this code at your own risk, I do not accept any responsibility for damage or inconvenience caused by executing any of this code in your environment