How to update pnpm version on macOS

I've been looking for the safest way to update pnpm on my MacBook. I've heard that you shouldn't use npm install -g pnpm because it can mess some things up, probably point to the wrong binary, and would still execute an old version.

Here's what I did:

  • I removed the pnpm binary:
where pnpm
 
# /opt/homebrew/bin/pnpm
 
rm -rf /opt/homebrew/bin/pnpm # the location of the binary might be different on your machine, just use the result of `where pnpm` here
  • And reinstalled it with Homebrew:
brew install pnpm

Published on August 2, 2024 1 min read