How to clean the pnpm store on a Mac

Find the store, spot the folder an old pnpm version left behind, prune what no project uses, and know why freed space can be less than du says.

7 min read · Updated October 9, 2026

pnpm saves disk space by keeping one copy of every package in a shared store and pointing your projects at it. That's why node_modules folders built by pnpm are small. The store itself grows, though, and on a Mac that has seen a few pnpm upgrades it can hold an old store version nobody uses anymore. Cleaning it is easy. Knowing how much space you'll actually get back takes a moment longer.

Where the store lives

On macOS the default store is ~/Library/pnpm/store. If you set PNPM_HOME or XDG_DATA_HOME, the store is under those instead. pnpm itself tells you which one is active:

pnpm store path

Inside the store there is one folder per store version. pnpm 10 bumped the store to v10. pnpm 11 moved to v11, with the package index in a single SQLite database, index.db, instead of millions of small files. pnpm 12 still uses v11. When you upgrade across a version bump, pnpm starts a new folder and the old one stays where it was.

The store is not the cache. pnpm keeps package metadata, the dlx cache and some install checks in ~/Library/Caches/pnpm, a separate and much smaller folder.

pnpm 12 can also create a store inside a project, at node_modules/.pnpm-store, when no folder above the project accepts a hard link. That happens in sandboxes and containers. It goes away with the project's node_modules.

Look before you delete

These commands only read:

# Each store version, and the metadata cache
du -sh ~/Library/pnpm/store/* ~/Library/Caches/pnpm 2>/dev/null

# The projects registered with the current store
ls -l "$(pnpm store path)/projects"

# Packages in the store that were changed after unpacking (exit code 0 means none)
pnpm store status

Every pnpm install registers its project under projects/. That list is how pnpm knows which packages are still in use. A long list of projects you deleted long ago is a hint that pruning will help.

Prune with pnpm's own command

pnpm store prune removes packages that no project on your Mac uses. The docs are clear that it's safe: it "is not harmful and has no side effects on your projects", and pnpm downloads anything removed again when a future install needs it.

# Removes unreferenced packages from the active store
pnpm store prune

Two things to know. It only works on the store version your pnpm uses, so a leftover v10 folder stays put. And pnpm suggests running it occasionally, not after every install, since a pruned package has to be downloaded again the next time a project wants it. The docs don't say whether it's safe to prune while an install is running, so let installs finish first.

Coding agents make this worth doing more often. A Claude Code or Codex worktree runs its own pnpm install, registers itself with the store, and is then deleted. Its packages stay in the store until a prune.

Why deleting can free less than du shows

On macOS, pnpm puts files into node_modules by cloning them from the store, and falls back to hard links. A clone is APFS copy-on-write: the copy in your project and the copy in the store share the same blocks on disk until one of them changes. A hard link is the same file under two names.

Either way, du counts those blocks once in the store and once in each project. Deleting the store frees only the blocks no project still shares. pnpm's docs don't say how much that is for a given store, and it differs from Mac to Mac. If your projects are still installed, the real gain can be far below the store's size.

An old store version is different. Projects installed by pnpm 11 or 12 don't point into v10, so the space a leftover v10 frees is close to what du shows, unless an old project of yours was never reinstalled.

Deleting by hand

For an old store version, check first that no project still needs it. Reinstall any project you still work on with your current pnpm, then move the folder to the Trash. The trash command comes with macOS 15 and later:

# Moves to the Trash: the store pnpm 10 used
trash ~/Library/pnpm/store/v10

# Moves to the Trash: pnpm's metadata cache
trash ~/Library/Caches/pnpm

What you give up:

Delete You lose
An old store version like v10 Fast installs for projects you never reinstalled with a newer pnpm
The active store Every package, downloaded again on the next install; projects that hard-link into it keep their files
~/Library/Caches/pnpm Package metadata, fetched again when needed

Space moved to the Trash comes back only when you empty the Trash.

Doing it with Devbroom

Devbroom recognizes ~/Library/pnpm/store by its exact path and lists it with the other developer caches. Scanning only reads.

  • The pnpm store is always Review, never Ready. Projects installed with pnpm share files with it, and space they share is not freed. Devbroom says so beside the item instead of promising the full size.
  • It's Blocked while something uses it. If a process runs from the store or holds a file in it open, such as an install in progress, the item waits, and it's ready again once that process exits.
  • Shared space is measured. When part of a folder is hard-linked from elsewhere, Devbroom shows how many MB would not be freed.
  • The node_modules in your projects are separate items, each checked for a package.json beside it, git ignore rules and running sessions.

If you'd rather not see developer caches at all, turn them off in Settings; build folders in your projects are always scanned. Whatever you clean moves to the Trash, and Put back returns it from History. The rules are in Verdicts and Rules, and you can download Devbroom for free.

More guides