# Is it safe to delete pnpm’s store?

Is it safe to delete? · Package caches · Updated 21 November 2026. By Mohit Nippanikar, who makes SiftMac.

## The short answer

- **Yes, by pruning it.** `pnpm store prune` removes packages no project on your Mac still uses, and pnpm’s docs call it harmless. Deleting the whole store by hand gains little and can bite.
- **What it costs you:** a pruned package downloads again if a project asks for it later.
- **Does it come back?** The store refills with every `pnpm install`, so prune it now and then.
- SiftMac’s verdict: Rebuilds

## 1. How pnpm’s store works

pnpm doesn’t give each project its own downloaded copy of each package. It keeps one content-addressable store per disk, where every file is stored once, and fills each project’s `node_modules` from it. How it fills them depends on the disk:

- On a Mac, the default `packageImportMethod`, `auto`, tries **clones** first. APFS supports copy-on-write clones, so a file in `node_modules` and the one in the store share their blocks until one of them is changed.
- Where cloning isn’t possible, pnpm falls back to **hard links**, two names for one file, and only then to plain copies.

Either way, a package used by twenty projects takes its space once. The flip side is that the store keeps every version your projects have moved through until something prunes it.

pnpm also keeps a smaller cache in `~/Library/Caches/pnpm`: package metadata from the registry, `pnpm dlx` downloads and some install checks.

## 2. Where it is

```
~/Library/pnpm/store
~/Library/Caches/pnpm
```

Those are the macOS defaults; `pnpm store path` prints the store in use. Keep projects on an external drive and pnpm makes another store on that drive, because links and clones only work within one disk.

## 3. How big it is, and what that number means

```
du -sh "$(pnpm store path)" ~/Library/Caches/pnpm
```

Read that number with care. `du` adds up every file it finds and can’t see that a file in the store and its clone in a project share blocks. Removing a package from the store frees its space only when no project still holds a clone or hard link of it. While some project’s `node_modules` shares those blocks, they stay in use.

## 4. How to clear it

1. Let any `pnpm install` that’s running finish.
2. Run `pnpm store prune`. It removes unreferenced packages, those not used by any project on the system. pnpm’s docs say it has no side effects on your projects and suggest running it occasionally, not constantly.
3. If you like, empty the metadata cache too. It refills on the next install.

```
pnpm store prune
rm -rf ~/Library/Caches/pnpm/*
```

Don’t move the store in Finder or delete it while projects still use it. A project set up with pnpm’s global virtual store, which is off by default, keeps only links into the store and stops working until it’s installed again.

## 5. What you’ll notice afterwards

- Nothing in your projects: each `node_modules` keeps its own clones or links of every file.
- An install that needs a pruned package downloads it again, and `pnpm-lock.yaml` keeps its version the same.
- The first install after emptying `~/Library/Caches/pnpm` fetches package metadata again, so it’s a little slower.
- Space comes back only for packages nothing shares any more; projects you keep hold on to theirs.

## Questions

### Why didn’t deleting node_modules in a pnpm project free much space?

The files there are clones, or hard links, of files in the store. Their blocks stay in use by the store until `pnpm store prune` removes packages no project references.

### Can I move pnpm’s store to an external drive?

Only together with your projects. pnpm wants the store on the same disk as the projects it serves; otherwise it copies packages instead of linking them, which uses more space, not less.

### How often should I run pnpm store prune?

Now and then, for example after deleting old projects. pnpm recommends it occasionally but not too often, since anything pruned has to be downloaded again when a project wants it.

### What is ~/Library/Caches/pnpm?

pnpm’s cache of package metadata, `pnpm dlx` downloads and some install checks. It’s safe to empty and refills as you install.

## How SiftMac handles it

SiftMac clears pnpm’s metadata cache in `~/Library/Caches/pnpm` with its App caches (verdict Rebuilds), and leaves the store in `~/Library/pnpm` to `pnpm store prune`, which knows what projects still use. When it lists an old pnpm project’s `node_modules` under Developer files, the size shown counts only blocks the folder doesn’t share with the store, so you see what deleting really frees.

Download: https://siftmac.com/SiftMac.dmg (scanning is free, and so is the first 2 GB of cleaning).

## Sources

- [pnpm: pnpm store (prune, path, status)](https://pnpm.io/cli/store)
- [pnpm: storeDir setting](https://pnpm.io/settings/store)
- [pnpm: packageImportMethod and the global virtual store](https://pnpm.io/settings/node-modules)
- [pnpm: cacheDir setting](https://pnpm.io/settings/other)
- [pnpm: FAQ](https://pnpm.io/faq)

## Related

- [Is it safe to delete node_modules?](https://siftmac.com/safe-to-delete/node-modules)
- [Is it safe to delete ~/.npm, npm’s cache?](https://siftmac.com/safe-to-delete/npm-cache)
- [Is it safe to delete Yarn’s cache?](https://siftmac.com/safe-to-delete/yarn-cache)
- [Honest sizes: only the space you really get back](https://siftmac.com/features/honest-sizes)
- [Xcode DerivedData, node_modules and Docker: what’s safe to delete on a developer’s Mac](https://siftmac.com/guides/developer-files-on-mac)

Canonical: https://siftmac.com/safe-to-delete/pnpm-store
