Homebrew Can Manage npm Packages for You

Homebrew logo with the words The Package Manager for Everywhere

If, like me, you manage your Homebrew installations with a dotfile-style Brewfile, you might not know that it can manage globally installed npm utilities too.

This is all you need to add:

npm "@agentclientprotocol/claude-agent-acp"
npm "@agentclientprotocol/codex-acp"

Why I needed this

The Homebrew packages for the Claude Code and Codex ACP adapters recently stopped updating after their code moved. Since the available models are wired into the ACP packages, I couldn’t use the new models in applications. I primarily use these packages with the excellent Agent Client extension in Obsidian.

The newer ACP versions can only be installed via npm. Since I use Chezmoi to manage the Brewfile across all my Mac and Linux development machines, this was a problem. My workaround was a Chezmoi “run-on-change” script that installed them, but it felt unclean. Chezmoi only ran it when the rendered script changed, not on every chezmoi apply.

Today, Codex told me I could just add them to my Brewfile. I was astonished that this is how I find out about new software features now. :)

The brew bundle documentation confirms that Brewfiles support npm packages. You can also add one from the command line with brew bundle add --npm <package>.

What happens on later runs?

Looking at the npm install implementation, Homebrew runs npm list -g --depth=0 --json once, then checks whether each package name in the Brewfile is present. If it is, Homebrew skips the install. This is idempotent and does not make a registry request or check for a newer version.

This also tells me that Homebrew does not currently upgrade these npm packages. It has no supported npm lockfile or version-pinning mechanism either. If I added npm "prettier@3.6.2", it might reach npm correctly, but Homebrew’s name-only check does not recognize it as installed, so it will run the install again every time.

Also, the install code doesn’t accept a version as a parameter. Given an npm package, it will just install whatever is latest.

For now, it is probably better to use a separate npm command or script when I need upgrades or exact versions.

When was this npm management feature added?

It seems pretty recently!

npm support was merged on March 24, 2026, first shipped in Homebrew 5.1.2 on March 30, and was highlighted in the Homebrew 6.0 announcement that June. The original feature discussion began in April 2024.

The Pull Request also notes:

Brew Bundle already supports cargo, go, uv, flatpak, vscode, and mas.

I didn’t know Brew Bundle supported some of those either!

tech
Codex's Built-In Web Search Can Return Stale Results Codex Gets Its AskUserQuestion