Is there a way to skip a brew package when upgrading?

When I try to upgrade my brew packages, the composer package keeps throwing an error:

==> Upgrading composer 1.10.13 -> 2.0.11
==> Downloading https://getcomposer.org/download/2.0.11/composer.phar
Already downloaded: /Users/me/Library/Caches/Homebrew/downloads/3555b6c6fce103b369f42c5c4f1b567b76bfb71f838b9bdcadddcffc7d279a22--composer.phar
Error: SHA256 mismatch
Expected: eabf2917072096a94679193762501319e621e2b369a4a1256b2c27f4e6984477
  Actual: d6eee0d4637f4bd82bdae098fceda300dcb3ec35bf502604fbe7510933b8f952
    File: /Users/me/Library/Caches/Homebrew/downloads/3555b6c6fce103b369f42c5c4f1b567b76bfb71f838b9bdcadddcffc7d279a22--composer.phar
To retry an incomplete download, remove the file above.

Deleting the package per the suggestion above doesn't help.

I don't see an option to skip a package to upgrade with --help but maybe I'm missing something?


Solution 1:

Another option is to pin the package to your current version. Then brew won't try to upgrade it. Later on it can be unpinned and upgraded. Here are some of the relevant commands.

# To pin a package:
brew pin composer

# To list pinned packages:
brew list --pinned

# To see which version a package is pinned to:
brew info composer

# To unpin a package:
brew unpin composer