
To clear the npm cache on a Mac, you use npm's own cleanup, because npm has no app or setting for it. The cache is in a hidden folder in your home folder, ~/.
npm never trims the cache by itself, so it grows with every package you install. Clearing it doesn't touch your projects: they keep working, and the next installs download again.
Yarn, pnpm and Bun keep caches of their own, in different places and with different rules. Some are plain folders you can move to the Trash in Finder. Others are shared with your projects or managed by the tool, so they're cleaned with the tool's own command.
None of them makes your Mac or your installs faster when it's cleared. It's the opposite: installs are slower until the cache fills again. Clear them to get space back, especially caches of tools you've stopped using.
This post goes through each cache: where it lives on a Mac, how large it gets, what each cleanup option removes, and what it costs you afterwards. If the space you're after is in your projects rather than in the caches, see how to delete all node_modules folders safely.
Where JavaScript package managers keep their caches on a Mac
Every package manager downloads packages once and keeps a copy, so the next project that needs the same version doesn't download it again. Each keeps that copy in its own folder, outside your projects, and shares it with every project on your Mac.
| Cache | Where it is | What's in it | Level |
|---|---|---|---|
| npm | ~/.npm/_cacache | Every package and package listing npm has downloaded | Safe |
| npx | ~/.npm/_npx | Packages downloaded to run one-off commands | Safe |
| Yarn 1 (Classic) | ~/Library/Caches/Yarn | Every package Yarn Classic has installed | Safe |
| Yarn 2 and later | ~/.yarn/berry/cache | Package archives that Plug'n'Play projects run from | Usually safe |
| pnpm store | ~/Library/pnpm/store | One copy of each package version your projects use | Safe, with pnpm's cleanup |
| pnpm cache | ~/Library/Caches/pnpm | Package information and one-off downloads | Safe |
| Bun | ~/.bun/install/cache | Every package version Bun has downloaded | Safe, with Bun's cleanup |
These are the default places. If you or a tool changed a package manager's settings, its cache can be somewhere else.
Why can't you see them in Finder?
npm's, Bun's and Yarn 2's caches are in folders whose names start with a dot, which Finder hides, and the others are inside your Library folder, which Finder hides too. You can still open any of them.
- In Finder, choose Go › Go to Folder.
- Type the path from the table, such as
~/. The tilde stands for your home folder.Library/ Caches/ Yarn - Press Return to open it.
To see a folder's size, select it and choose File › Get Info. Large caches can take a moment to count.
How do you tell which package managers you've used?
The folders themselves tell you. If ~/ exists, you've installed something with Yarn 1 at some point; if ~/ exists, you've used Bun. A cache folder that's still there for a tool you no longer use is the easiest space to get back.
In your projects, the lock file next to package.json names the tool: package-lock.json for npm, yarn.lock for Yarn, pnpm-lock.yaml for pnpm and bun.lock for Bun. If none of your current projects has one of those, that tool's cache serves nothing you're working on.
Do they count as System Data?
Mostly, yes. Storage settings, in System Settings › General › Storage, counts some of Xcode's files under Developer, but package managers' caches usually fall into System Data with everything else it can't name. The System Data guide explains what else ends up there.
That's one reason a developer's System Data figure can be much larger than someone else's on the same Mac model.
How big do they get?
There's no typical size, because it depends on how many projects you install, how often their dependencies change, and how long you've used each tool. npm and pnpm both say plainly that they don't remove old packages by themselves.
- pnpm store12 GB · Safe
- pnpm cache3.8 GB · Safe
- npx cache2 GB · Safe
- npm cache1.1 GB · Safe
- node-gyp headers0.1 GB · Safe
Measured on one Mac in October 2026, after about a year and a half of web projects. Yarn and Bun weren't used on it. The pnpm store's space is partly shared with installed projects, so cleaning it frees less than its full size.
The pnpm store led on that Mac, but it isn't all removable: some of it is the same data as the node_modules folders of installed projects. The npx and pnpm caches were the surprise: they hold tools run with one-off commands, kept long after each run.

How to clear the npm cache on a Mac
npm keeps everything in ~/. The downloads are in _cacache, the one-off command packages in _npx, and recent debug logs in _logs.
What's in npm's cache?
_cacache holds every package and package listing npm has downloaded, stored by content rather than by name, so you won't find folders named after packages inside. npm reuses it whenever any project installs the same version again.
npm's documentation says plainly that npm won't remove data by itself, and that the cache grows as new packages are installed. Its size reflects how long you've used npm and how many projects you've installed with it.
Does npm have a way to clear it without Terminal?
No. npm is a command-line tool, and it has no app, menu or setting for its cache. Its documented way to clear the cache is its own cache command, which asks for an extra confirmation flag before it removes anything.
The folder's contents aren't meant to be browsed or edited by hand: npm says it offers no way to inspect or manage them directly. That's why the catalog treats npm's cleanup as npm's job rather than a folder to move to the Trash.
Can npm keep its cache somewhere else?
Yes. npm reads a setting called cache from its configuration files, and the one for your account is a hidden file in your home folder, .npmrc. If that file has a cache line, npm's cache is in the folder it names rather than in ~/.
That's worth checking when ~/ is small but you know npm has installed a lot, or when a company setup moved it. Projects can have an .npmrc of their own too, but they rarely move the cache.
What do npm's cache options remove?
npm's cache command has two options that matter for space:
- Clean removes everything in the cache, or a single entry if you name one. Everything is downloaded again the next time a project needs it.
- Verify checks the cache, removes data npm no longer needs, and checks the rest for damage. It frees less, and keeps what's still in use.
npm describes its cache as self-healing: damaged data is detected and downloaded again automatically. So, in npm's own words, there's no reason to clear the cache other than getting disk space back. It isn't a fix for slow or failing installs.
What is the npx cache?
When you run a command with npx, or npm's exec command, and its package isn't part of the current project, npm installs that package into a folder in ~/ and runs it from there. Project generators and other tools run this way pile up, one folder each.
On the Mac measured above, 14 of these folders held about 2 GB, more than the main npm cache. Many were copies of the same few tools: one had three folders of about 340 MB each, another had five.
To clear it in Finder, choose Go › Go to Folder, type ~/, and move the folders inside to the Trash. The folders are named with codes rather than package names, so it's simplest to remove them all. Each tool downloads again the next time you run it.
What about npm's logs?
npm writes a debug log in ~/ each time it runs, and deletes the oldest when there are more than its limit. The folder stays small, about 50 KB on the Mac measured above, so it isn't worth clearing for space.
Yarn's caches: Yarn Classic and Yarn 2 and later
Yarn has two families with different caches. Yarn 1, now called Yarn Classic, works much like npm. Yarn 2 and later, sometimes called Yarn Berry, can run projects straight from its cache, which changes what clearing it means.
Is it safe to delete the Yarn Classic cache?
Yes. Yarn Classic keeps a copy of every package it installs in ~/ and reuses it for later installs in any project. Projects that are already installed don't use it, and Yarn fills it again the next time it installs.
- Quit any running installs.
- In Finder, choose Go › Go to Folder, type
~/and press Return.Library/ Caches - Move the Yarn folder to the Trash.
- Empty the Trash when you're sure you don't need it back.
Yarn Classic's own cache command does the same from Terminal, and can also remove single packages. It has no app or button.
Why is the Yarn 2 cache only usually safe?
Yarn 2 and later store each package as a zip archive in a cache shared by every project, by default in ~/. Projects that use Plug'n'Play, Yarn's default way of installing, don't have a node_modules folder: they load their packages straight from these archives.
So removing this cache stops those projects from running until you install their dependencies again with Yarn. Nothing is lost, since every archive downloads again, but it's not a cache in the sense of something nobody uses right now. Projects that use a node_modules folder instead keep working.
What do Yarn's cache options remove?
Yarn 2 and later have one cache command with three scopes, according to Yarn's documentation:
- No option: removes the current project's local cache files.
- Mirror: removes the global cache files in
~/instead..yarn - All: removes both, the global cache and the current project's.
Which one frees space depends on how the project is set up. With Yarn's default settings, packages go to the global cache, so that's where most of the space is.
A project's own .yarn/cache folder
Some Yarn projects keep their cache inside the project, in a .yarn/cache folder, and commit it to Git. Yarn calls this an offline mirror: it lets the project install without the internet, and, with Plug'n'Play, run straight after a checkout.
That folder is part of the repository, not a cache to clear. Removing it changes the project's files, and Git will show every archive as deleted. Leave it to the project's own decisions.

pnpm: the store and the cache
pnpm keeps two folders, and they behave very differently. The store holds the packages your projects use. The cache holds information about packages and the downloads for one-off commands.
| Folder | Where it is | Shared with projects? | How to clear it |
|---|---|---|---|
| Store | ~/Library/pnpm/store | Yes, file by file | pnpm's store cleanup, which removes only unused packages |
| Cache | ~/Library/Caches/pnpm | No | Move it to the Trash |
Why does the pnpm store look so large?
pnpm saves each package version once in the store and puts it into every project that needs it, as an APFS clone on a Mac or as a hard link. The project's copy and the store's copy are the same data on the disk.
So the store's size counts space your installed projects are using too. pnpm's documentation puts it simply: a 1 MB package shows up as 1 MB in the project and 1 MB in the store, but takes 1 MB in total.
What does pnpm's store cleanup remove?
pnpm's store cleanup removes packages that no project on your Mac uses any more. A package becomes unused when a project updates it to a newer version or stops depending on it.
pnpm's documentation says the cleanup is harmless and has no side effects on your projects. If a later install needs a removed package, pnpm downloads it again. It recommends running it occasionally, but not too often, since switching branches can bring back packages you just removed.
There's no app or button for it. It's a command, and pnpm prints how much it removed when it's done.
Don't move the pnpm store to the Trash
Moving the whole store to the Trash removes every package at once, including the ones your projects use right now. It frees less than its size suggests, because the projects still hold their copies, and every project's next install has to download everything again.
pnpm's own cleanup is the better route: it removes only what nothing uses, which is where the real space is.
Store folders from older pnpm versions
Inside the store, pnpm keeps a folder named after the store's format, such as v10 or v11. pnpm 11 introduced a new format, store v11, so a Mac upgraded from earlier versions can have several of these folders side by side.
On the Mac measured above, the store held three: v3 at 5.3 GB and v10 at 5.5 GB, both left by older pnpm releases, and the current v11 at 1.1 GB. pnpm's documentation doesn't say what happens to older format folders, and its cleanup works on the store it currently uses.
Is it safe to delete the pnpm cache folder?
Yes. ~/ holds information about packages from the registry, the packages pnpm downloads to run one-off commands with its dlx command, and some results it uses to check installs. It isn't shared with your projects.
Quit any running installs, choose Go › Go to Folder in Finder, type ~/, and move the pnpm folder to the Trash. The next installs and one-off commands take a little longer while pnpm downloads package information again.
On the Mac measured above, this folder held 3.8 GB, most of it one-off command downloads.
Why do pnpm's one-off downloads pile up?
pnpm's dlx command is its version of npx: it downloads a tool, runs it, and keeps the download so the next run starts faster. By default, pnpm treats that download as expired after a day and fetches the tool again the next time.
Expired doesn't mean removed. On the Mac measured above, the dlx folder held 13 downloads, some from runs ten days earlier, together about 2.4 GB. Clearing the cache folder is what takes them away.
Bun's install cache
Bun stores every package version it downloads in ~/, in folders named after the package and version. When a project's package.json asks for a version the cache already has, Bun uses the cached copy instead of downloading it.
How Bun shares the cache with your projects
On a Mac, Bun puts packages into a project's node_modules with clonefile, which makes APFS clones. Bun's documentation says a clone takes no extra space on the disk until a file in it changes.
That means the cache and your installed projects share the same space. Clearing the cache frees only the part no installed project shares, and the rest comes back only when those projects' node_modules folders go too.
What does Bun's cache cleanup remove?
Bun's documented cleanup clears the whole global cache, not just the packages nothing uses. Projects that are already installed keep working, because their files are clones, and the next installs download again.
Like npm, Bun is a command-line tool with no app or setting for this. Its cleanup is a command.

Other JavaScript caches worth knowing
Package managers aren't the only JavaScript tools that keep downloads. Several tools that projects install keep large files of their own, outside the projects, and they stay after the projects are gone.
| What | Where it is | What's in it | Level |
|---|---|---|---|
| node-gyp | ~/Library/Caches/node-gyp | Node.js headers for building native packages | Safe |
| nvm | ~/.nvm/.cache | Node.js downloads kept after installing a version | Safe |
| Electron | ~/Library/Caches/electron | Electron releases downloaded by projects | Safe |
| Puppeteer | ~/.cache/puppeteer | Chrome builds for Puppeteer scripts and tests | Usually safe |
| Playwright | ~/Library/Caches/ms-playwright | Browser builds for Playwright tests | Usually safe |
| Cypress | ~/Library/Caches/Cypress | Copies of the Cypress test app | Usually safe |
The first three come back by themselves the next time they're needed. The browser and test-app downloads come back too, but only when you install the project's dependencies again, so a test suite can fail to start until you do.
Which ones are worth clearing?
The browser downloads are the large ones: Puppeteer's documentation puts its Chrome download at about 170 MB on a Mac, and Playwright keeps a folder per browser version. If you no longer run browser tests, these are worth a look.
The node-gyp and nvm caches are smaller: node-gyp's held about 64 MB on the Mac measured above. Clear them when you've moved on from the Node.js versions they hold, not as a routine.
What about globally installed tools?
Tools you installed globally, such as a command-line tool you use in every project, aren't in any cache. npm puts them in a lib/node_modules folder inside the Node.js installation, so clearing a cache never removes them. Uninstall the ones you no longer use with the package manager that installed them.
If you use a Node.js version manager such as nvm, each Node.js version keeps its own global tools, in ~/. Old versions stay after you move to a newer one. Each needs a decision, because projects that ask for that version stop working without it.
Build caches inside projects
Build tools also keep caches inside each project, such as a .next folder for Next.js or .turbo/cache for Turborepo. Those belong to the project, not to a package manager, and they come back on the next build.
For each tool's own folder, from Next.js to Vite, see the post on JavaScript build caches.
What clearing a cache costs
Clearing a package manager's cache never changes your code or your installed projects. What it changes is the next install.
Does clearing the npm cache break anything?
No. Projects that are already installed don't read from the cache, so they keep working, and the next install fills the cache again.
The exception is Yarn 2 and later with Plug'n'Play, where the cache is what projects run from. There, clearing it means installing again before the project runs.
Does clearing caches make anything faster?
No. A cache exists to make installs faster, so clearing it makes the next installs slower, not quicker. It doesn't make your Mac faster either: the space comes back, and that's all.
The other reason people clear a cache is a failing install, and npm's documentation says even that shouldn't be needed for its cache, because it repairs itself.
What it costs, cache by cache
| Cache | After clearing it | Can it be put back? |
|---|---|---|
| npm, with npm's cleanup | Next installs download everything again | No: npm removes it directly |
| npx, in Finder | Each one-off tool downloads again when run | Yes, until you empty the Trash |
| Yarn Classic, in Finder | Next installs download again | Yes, until you empty the Trash |
| Yarn 2 and later, in Finder | Plug'n'Play projects need a fresh install | Yes, until you empty the Trash |
| pnpm store, with pnpm's cleanup | Only unused packages go; nothing changes for projects | No: pnpm removes them directly |
| pnpm cache, in Finder | Next installs fetch package information again | Yes, until you empty the Trash |
| Bun, with Bun's cleanup | Next installs download again | No: Bun removes it directly |
When not to clear them
Keep the caches if you're about to work without a reliable connection, such as on a flight, or on a slow or metered network. A fresh install of a large project can download hundreds of megabytes.
Also keep them if you're about to reinstall many projects, for example after removing their node_modules folders. A full cache makes those installs much quicker; clear it afterwards if you still want the space.
Which cache to clear first
If space is short, start where the most space is that nothing uses. For most Macs with JavaScript projects, that order works.
A worked example
Take the Mac measured above. The npx cache and the pnpm cache together held almost 6 GB, all of it downloads that come back on demand and that nothing installed depended on. Those two folders go to the Trash in Finder, with no command needed.
Next, pnpm's store cleanup frees packages no project uses. How much depends on how much has changed since the last time, from almost nothing to several gigabytes. Last, npm's cache can be cleared too, at the cost of slower next installs.
How the four cleanups compare
| Tool | What its cleanup removes | Keeps what projects use? | App or button? |
|---|---|---|---|
| npm | The whole cache, or only unneeded data with verify | Only with verify | No |
| Yarn 1 | The whole cache, or the packages you name | No | No |
| Yarn 2 and later | The project's cache, the global cache, or both | No | No |
| pnpm | Store packages no project uses | Yes | No |
| Bun | The whole cache | No | No |
None of the four has a graphical interface for its cache. npx's folder, Yarn's caches and pnpm's cache folder can go to the Trash in Finder; the rest are cleaned by the tools themselves.
Order of attack
- Caches of package managers you no longer use at all, such as Yarn Classic after moving a team to pnpm.
- One-off command caches: npx and pnpm's.
- pnpm's store cleanup and npm's verify, which keep what's in use.
- The full npm or Bun cache, if you still need more room.
- Browser and test-app downloads for projects you no longer test.

Mistakes to avoid
Clearing these caches is low risk, but a few habits make it lower.
Don't move the whole Caches folder
The Yarn and pnpm caches are folders inside ~/, next to the caches of every app on your Mac. Move only the tool's own folder. The Caches folder itself is one that apps expect to exist.
The post on freeing up space on a Mac covers clearing the app caches next to them.
Don't clear a cache during an install
Quit installs, builds and development servers that might be downloading packages first. A tool whose cache disappears halfway through an install can fail with confusing errors, and you'd have to run the install again anyway.
Don't use administrator rights for your own caches
Every cache in this post is in your home folder and belongs to your account. A guide that asks for your administrator password to clear one is doing more than it needs to, and a command run that way can remove files anywhere on the disk. Finder, and the tools' own cleanups, need no password.
Keep the caches from growing back
Every cache here grows back as you work, and that's what it's for. The aim is to keep it in proportion, not at zero.
How often should you clear them?
There's no schedule that suits everyone. Looking every few months, or when System Data jumps, is enough for most people. pnpm's documentation suggests running its store cleanup occasionally, not constantly.
Tools you've stopped using deserve a one-time clear, because nothing will clear them for you. A Yarn Classic cache can sit untouched for years after the last project moves on.
Do they need to be in Time Machine backups?
No. Everything in them can be downloaded again, so backing them up mostly costs space on your backup disk. To exclude them from Time Machine, open System Settings › General › Time Machine, click Options, click the Add button and select the folders.
Apple notes that excluded items still appear in Time Machine's local snapshots on your Mac, so excluding them doesn't change the space they take there.
What happens to a cache when you remove the tool?
Removing a package manager doesn't always remove its cache. npm's cache, for example, is in your home folder, and uninstalling Node.js leaves it in ~/. The same goes for Yarn's and pnpm's folders in your Library.
So when you stop using a tool, remove its cache as well, the same day. Otherwise it waits, unused, until a disk map or a full disk turns it up.
Does switching package managers help?
pnpm and Bun keep one copy of each package for all your projects, which uses less space overall than npm's copy per project. But each package manager you use keeps its own cache, so switching without clearing the old one's cache adds a cache rather than replacing one.
How the app does it
Wombit finds each of these caches, explains what it is and what clearing it costs, and shows its size, with hard links and APFS clones counted once. Select one on the map to see its level and a Move to Trash or Clean Up button.
The package managers' caches are Safe and start checked in Cleanup, except Yarn 2's shared cache, which is Usually safe because Plug'n'Play projects run from it:
~/
.npm/ _cacache Packages and package information npm has downloaded, kept so it doesn't download them again.
Safe · Runs npm cache clean --force
~/
.npm/ _npx Packages npx downloaded to run commands that aren't installed in a project.
Safe · Moves it to the Trash
~/
Library/ Caches/ Yarn Packages downloaded by Yarn 1 (Yarn Classic), kept so installs don't download them again.
Safe · Moves it to the Trash
~/
.yarn/ berry/ cache Package archives that all your projects using Yarn 2 or later share.
Usually safe · Moves it to the Trash
~/
Library/ pnpm/ store The shared store where pnpm keeps one copy of every package version your projects use.
Safe · Runs pnpm store prune
~/
Library/ Caches/ pnpm Package information and pnpm dlx downloads that pnpm keeps to make installs faster.
Safe · Moves it to the Trash
~/
.bun/ install/ cache Packages Bun has downloaded, kept in one place and reused by every project.
Safe · Runs bun pm cache rm
Plain folders, such as Yarn Classic's cache and pnpm's cache, go to the Trash, where Put Back returns them. npm, pnpm's store and Bun are cleaned with the tool's own command after the review sheet.
What a command removes can't be put back, and the sheet says so. For pnpm's store, which removes only unused packages, the sheet shows the space as "up to" a size.
What the app runs, after you review itPRO
- npm cache clean --force
- npm's package cache
- pnpm store prune
- Packages in pnpm's store that no project on your Mac uses any more
- bun pm cache rm
- Bun's global install cache
Seeing every cache and what it holds is free. Clearing them in Cleanup is PRO: one payment of $4.99 with lifetime access. Every Pro tool's review is free to open, so you see what would go and why before you buy.
Frequently asked questions
Where is the npm cache on a Mac?
In a hidden folder in your home folder: ~/.npm/_cacache holds the downloaded packages, ~/.npm/_npx the packages npx downloads, and ~/.npm/_logs npm's recent logs. In Finder, choose Go › Go to Folder and type ~/.npm to open it. A changed npm setting can put the cache somewhere else.
Is it safe to clear the npm cache?
Yes. Projects that are already installed don't read from it, so they keep working, and npm downloads whatever it needs again. The cost is slower installs, and an internet connection for them, until the cache fills again.
Will clearing the npm cache fix install errors?
Rarely. npm's documentation describes its cache as self-healing: damaged data is detected and downloaded again automatically. It says there's no reason to clear the cache other than getting disk space back.
Does clearing the npm cache delete node_modules?
No. The cache and each project's node_modules folder are separate. Clearing the cache leaves every installed project as it is, and removing node_modules is a separate step you take project by project.
How do I clear the Yarn cache on a Mac?
For Yarn 1, move ~/Library/Caches/Yarn to the Trash in Finder, using Go › Go to Folder to get there. Yarn 2 and later keep a shared cache in ~/.yarn/berry/cache; removing it works too, but Plug'n'Play projects then need a fresh install before they run.
How much space does the pnpm store really use?
Less than its folder size suggests. pnpm puts each package into your projects as a clone or hard link of the store's copy, so the store and the projects share the same space. pnpm's own store cleanup frees the packages no project uses.
Where does Bun store packages on a Mac?
In ~/.bun/install/cache, in a folder for each package and version. Bun puts them into projects as APFS clones, which share space with the cache. Bun's own cleanup clears the whole cache, and projects that are already installed keep working.
Sources
- Go directly to a specific folder on Mac · Apple
- npm cache · npm
- pnpm store · pnpm
- Other settings: cacheDir · pnpm
- yarn cache clean · Yarn
- Global cache · Bun