How to pin a Homebrew package

Homebrew pinning keeps an installed formula or cask on its current version while normal upgrade runs move other packages forward. The hold is useful when a newer release breaks a script, service, editor plugin, or desktop app and the working version needs to stay in place during compatibility testing.

A pin applies to a package that Homebrew already has installed. Confirm the token and type first, because the same name can sometimes resolve differently as a formula, cask, alias, or tapped package.

Pinned packages are skipped by brew upgrade, but the hold can affect dependents that need a newer formula. Pinned casks with auto_updates true may still update themselves outside Homebrew, so treat cask pins as a Homebrew upgrade hold rather than a full application update block.

Steps to pin a Homebrew package:

  1. Check the installed package and version.
    $ brew list --versions hello
    hello 2.12.3

    Replace hello with the installed formula or cask token. Use brew info first when the package name or type is unclear.
    Related: How to check Homebrew package information

  2. Pin the package with the package type made explicit.
    $ brew pin --formula hello

    Use --cask instead of --formula for cask tokens, such as visual-studio-code.

  3. Verify that Homebrew saved the pin.
    $ brew list --pinned
    hello

    No output means no packages are currently pinned. A package name in the output is the Homebrew hold state that normal upgrades skip.

  4. Check only the target package when reviewing a later upgrade window.
    $ brew list --pinned hello
    hello

    brew upgrade skips pinned packages until the package is unpinned. Other formulae that need a newer version of the pinned formula may fail to install or run.
    Related: How to upgrade Homebrew packages
    Related: How to unpin a Homebrew package