I own a Mac M1 with Monterey 12.3.1. I often experience problems uninstalling brew packages. Here an example:

I installed pnpm with homebrew. Then, I tried to uninstall it:

brew uninstall pnpm

If I brew uninstall pnpm, the following message appears:

Error: No such keg: /opt/homebrew/Cellar/pnpm

Still, pnpm is installed:

$> which pnpm                                           

So, it seems that homebrew is looking up at Cellar while the package is at /opt/homebrew/bin. I don't get the concept of Cellar. Is it a homebrew configuration problem?

How to fix homebrew to uninstall correctly?

  • 2
    Cellar is where all Homebrew packages get installed, there are only symlinks in bin. Did you install pnpm via Homebrew at all? Is /opt/homebrew/bin/pnpm a symlink and where does it point to?
    – nohillside
    Commented Apr 13, 2022 at 10:00
  • Have you tried brew uninstall pnpm --force? This may cause it to uninstall the files, even if it thinks they aren't there
    – Ezekiel
    Commented Oct 23, 2022 at 23:23

1 Answer 1

corepack enable && corepack prepare pnpm@latest --activate

As per Corepack docs & pnpm docs.

This won't uninstall Homebrew's pnpm, but it will effectively replace it with Corepack's version.

I had the same issue, but only when using node v18 (via nvm). (I had already run corepack enable in node v16)

With node v16:

% which pnpm

With node v18:

% which pnpm

/opt/homebrew/bin/pnpm links to /opt/homebrew/lib/node_modules/pnpm/bin/pnpm.cjs.

Still not sure why it's there, I thought maybe from a brew install node, but brew uninstall node + brew autoremove didn't get rid of it. At any rate, I'm happy just to be back to using Corepack's pnpm.

PS: brew leaves will "list installed formulae that are not dependencies of another installed formula", it only really makes sense to brew uninstall those formulae, as others are just dependencies.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .