brew upgrade updates everything at once, which is great until one tool’s new version breaks your project. You can hold that one back.
Pin the formula and upgrades skip it:
brew pin node
brew list --pinned
brew upgrade
brew upgrade now leaves node alone and says so in its output. When you are ready, release it:
brew unpin node
I would pin for a reason I can name, like a database whose data format changes between versions or a compiler a project is tested against. Write that reason down somewhere, because a pin you forgot about turns into a very old, unpatched package.
For anything with a versioned formula, such as postgresql@16 or [email protected], installing that one is often cleaner than pinning the plain name. It never jumps a major version by itself.
Homebrew warns about the side effect itself: other packages that need a newer version of a pinned formula may fail to install or run. A pinned cask that updates itself, like many browsers, can still update outside Homebrew.
Further reading: brew manpage (Homebrew docs)