SiftMac
Is it safe to delete? · Package caches · Updated 21 November 2026

Is it safe to delete Bun’s install cache?

By Mohit Nippanikar, who makes SiftMac

The short answer
On this page
  1. What’s in ~/.bun
  2. Where the cache is
  3. How big it gets
  4. How to clear it
  5. After clearing
  6. Questions

1. What’s in ~/.bun

Depending on how you installed Bun, ~/.bun can hold the tool itself as well as its cache:

On a Mac, Bun copies packages into each project’s node_modules with clonefile, the copy-on-write clone APFS offers. Bun’s docs point out what that means: the clone takes no extra disk space, and patching a package in one project can’t change it in another.

2. Where the cache is

~/.bun/install/cache

That’s the default. The BUN_INSTALL_CACHE_DIR variable or dir under [install.cache] in bunfig.toml can move it. Inside any project folder, bun pm cache prints the folder Bun is using.

If you turned on Bun’s global store, which is off by default, the package files your projects link to live in the cache as well, in its links folder.

3. How big it gets

The cache keeps each version of each package any of your projects installed, so it reflects how many projects you’ve worked on over time rather than how many you still have. Measure it next to the parts you keep:

du -sh ~/.bun/install/cache ~/.bun/install/global ~/.bun/bin

Because of the clones, the cache and your projects’ node_modules overlap on disk: together they use less space than their two sizes added up.

4. How to clear it

  1. Stop bun install, bun dev and anything else Bun is running.
  2. In a project folder, see what would be deleted, then clear it.
bun pm cache rm --dry-run
bun pm cache rm

This deletes everything in the cache folder, the global store in links/ included, and keeps the folder itself. Bun can’t remove a single package this way: bun pm cache rm <package> is an error. For one package with stale registry data, Bun’s docs suggest bun add <pkg> --force or bun update <pkg> instead of clearing.

One quirk: bun pm cache rm takes the folder from BUN_INSTALL_CACHE_DIR, --cache-dir or BUN_INSTALL, and ignores a cache folder named in bunfig.toml. If you moved the cache there, pass the same folder with --cache-dir.

Don’t delete ~/.bun as a whole unless you mean to remove Bun: with the install script, that takes the bun command and your global tools with it.

5. After clearing

Questions

Can I delete the whole ~/.bun folder?

Only when you’re removing Bun. With the install script, ~/.bun/bin is where the bun command lives, so deleting the folder uninstalls Bun and every global package with it.

Will bun pm cache rm break my projects?

Not with Bun’s defaults. On a Mac, Bun clones files into node_modules, so projects keep their own copies. Projects that opted into the global store link into the cache instead and need bun install again.

Can I remove one package from Bun’s cache?

No; the cache is cleared as a whole. For one package with outdated registry data, bun add <pkg> --force or bun update <pkg> refreshes it without clearing anything.

Why didn’t bun pm cache rm empty the folder I set in bunfig.toml?

Clearing ignores bunfig.toml, .npmrc and .env and uses BUN_INSTALL_CACHE_DIR, --cache-dir or BUN_INSTALL. Point one of those at your folder and run it again.

How SiftMac handles it. SiftMac doesn’t clear ~/.bun. Its space map labels the folder as the Bun runtime with its package cache, which downloads again when needed; bun pm cache rm does the clearing. For old Bun projects, Developer files lists node_modules with the space deleting would free, counting cloned files only for blocks they don’t share. A bun folder in ~/Library/Caches, if your Mac has one, is cleared with App caches and left alone while bun is running.

Download SiftMac · scanning is free, and so is your first 2 GB of cleaning · See how it works