0

I would like to filter brew upgrade (which, by default, upgrades all installed packages to their latest versions) to only automatically update the 'chaff' - any packages which saw minor bumps, for which I am too lazy to read changenotes or worry about.

This feature was proposed but rejected by the Homebrew team; the goal here is to script this externally to Homebrew so upstream interest isn't necessary.

ELLIOTTCABLE
  • 17,185
  • 12
  • 62
  • 78

1 Answers1

0

I'm using this shell script to handle it for me. It requires jq (brew install jq) and the semver package from npm.

brew upgrade $(
   brew outdated --json | \
      jq -r '(.formulae[] | [.name, .installed_versions[-1], .current_version]) | join(" ")' | \
      while read -r formula current new; do
         if (semver --range '~'$current $new >/dev/null);
            then >&2 echo "${formula}: $current --> $new"; echo "$formula"; fi
      done
)

My solution will invoke bare brew upgrade if there's no minor packages to upgrade, which will update everything else; be careful!

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
ELLIOTTCABLE
  • 17,185
  • 12
  • 62
  • 78