Each of the three has its own command:
pnpm store prune
yarn cache clean
bun pm cache rm
They do different things. pnpm removes only what no project uses. Yarn and Bun empty the whole cache. Below: where each one lives on a Mac, how to see its size first, and what happens on the next install.
pnpm: prune the store, do not delete it
pnpm keeps one copy of every package version in a store and hard-links the files into each project's node_modules. Ask it where the store is:
pnpm store path
On a Mac the answer is under ~/Library/pnpm/store. Size it:
du -sh "$(pnpm store path)"
Then prune:
pnpm store prune
Two details save confusion:
- Order matters. A package stays "referenced" while any
node_moduleslinks to it. To get space back from old projects, delete their node_modules first, then prune. - A deleted pnpm
node_modulesfrees little by itself. The files are hard links, so the bytes stay in the store until the prune.
pnpm has no dry run for the prune. It prints how many files and packages it removed when it is done. There is also a small metadata cache in ~/Library/Caches/pnpm. It is refetched when needed.
Yarn 1: one cache folder
yarn cache dir
Yarn 1 answers with a folder under ~/Library/Caches/Yarn. Check the size, then clean:
du -sh "$(yarn cache dir)"
yarn cache clean
yarn cache clean empties the cache. Add a package name, as in yarn cache clean react, to remove one package only.
Yarn 2 and later: global and per project
Modern Yarn has two places:
| Cache | Path | Command |
|---|---|---|
| Global, shared by all projects | ~/.yarn/berry/cache |
yarn cache clean --mirror |
| Local to one project | .yarn/cache in the project |
yarn cache clean |
| Both | yarn cache clean --all |
Yarn 4 uses the global cache by default, so most projects have no .yarn/cache at all.
One warning. Some teams commit .yarn/cache to git so that a clone needs no install ("zero-installs"). In such a project the cache is source, not a cache. Check before you clean:
git ls-files .yarn/cache | head -3
If that prints file names, leave the folder alone.
Bun
bun pm cache
prints the cache folder, ~/.bun/install/cache by default. Size and clear:
du -sh "$(bun pm cache)"
bun pm cache rm
Which one first
If the disk is full and you want the most space for the least waiting:
- Delete
node_modulesin projects you have not opened for a month. - Run
pnpm store prune. Nothing you use is removed. - Clear the cache of a package manager you no longer use at all. If every project moved from Yarn to pnpm, the Yarn cache is dead weight.
- Clear the caches you do use last. They make the next installs slower.
The npm cache follows the same logic and has its own guide: how to clear the npm cache.
Two places people miss
A second pnpm store on another disk. Hard links cannot cross disks. When a project lives on an external or second disk, pnpm creates a separate store at the root of that disk, in a folder named .pnpm-store. pnpm store path, run inside such a project, shows it. Prune it from there.
Corepack's copies of the package managers themselves. If you use Corepack, every version of Yarn and pnpm that a packageManager field ever asked for is kept in ~/.cache/node/corepack:
du -sh ~/.cache/node/corepack/*/* 2>/dev/null
Each one is a few megabytes, and they add up over years of version bumps. corepack cache clean removes them. Corepack downloads a version again the next time a project asks for it.
If you are not sure which package manager a project uses, look at its lockfile: pnpm-lock.yaml means pnpm, yarn.lock means Yarn, bun.lock or bun.lockb means Bun, and package-lock.json means npm.
With Wipzy
All of these are rows in Wipzy's Dev caches list, in the free plan. Each row shows its size before you choose.
| Row | Path | Level | How it is cleaned |
|---|---|---|---|
| pnpm store | ~/Library/pnpm/store |
Your call | Runs pnpm store prune |
| pnpm metadata cache | ~/Library/Caches/pnpm |
Safe | Moved to the quarantine |
| Yarn cache | ~/Library/Caches/Yarn, ~/.yarn/berry/cache |
Safe | Moved to the quarantine |
| Bun cache | ~/.bun/install/cache |
Safe | Moved to the quarantine |
Two rules explain the table:
- Moved means undoable. A Safe cache is not deleted. It is moved into a quarantine on the same disk, and Undo in History puts it back. The space is freed when you press Free now.
- A command cannot be undone, so it is never ticked for you. The pnpm store has to be cleaned by pnpm itself, or its index would no longer match its files. Wipzy runs exactly
pnpm store prune, as a fixed list of arguments and never through a shell, and marks the row Your call. The plan sheet says so before you approve.
Nothing is cleaned in one click: scan, Review plan, then Clean. See how the four risk levels work and what is free and what is Pro.
Questions
Is pnpm store prune safe?
Yes. It removes only packages that no project on the machine links to. Installed projects keep working. A later install of an older project may have to download a package again.
Can I delete the pnpm store folder by hand?
You can, but it frees nothing while projects still hard-link to the files, and every project then downloads its packages again. pnpm store prune is the command made for this.
Does Yarn 4 keep a cache in every project?
Only if you turned the global cache off. By default Yarn 4 keeps one shared cache in ~/.yarn/berry/cache.