What is ~/.bun/install/cache on Mac? Is it safe to delete?
Yes, the Bun cache is safe to delete. It holds copies of packages Bun has already downloaded, and Bun fetches them again the next time a project needs them.
Where it is
~/.bun/install/cacheWhat it is
Bun, the JavaScript runtime and package manager, keeps every package version it downloads in a global cache at ~/.bun/install/cache. When you run bun install in a project, Bun links or copies packages from this cache instead of downloading them again, which is a large part of why it is fast.
It grows with every package and version your projects have used. Bun does not remove old entries by itself.
The rest of ~/.bun is different: ~/.bun/bin holds the bun program and any tools you installed globally. Leave that alone unless you are removing Bun.
How big it gets
Often several hundred MB to several GB, depending on how many projects you install with Bun.
How to clear it by hand
- Run the command below. It deletes everything in Bun's global package cache.
- To check the location first, run bun pm cache, which prints the cache folder.
- Run bun install in a project when you next work on it. Bun downloads its packages again.
bun pm cache rmWhat happens afterwards
The next bun install in each project needs the network and takes longer than usual. Projects that are already installed keep working, because their node_modules folders are not touched.
How Diskzy handles it
Diskzy lists the Bun cache in the Clean up tab and ticks it, like the npm, Yarn and pnpm caches.
Related guides
- npm cache~/.npm/_cacache
- pnpm store~/Library/pnpm/store
- Yarn cache~/Library/Caches/Yarn
- node_modules<project>/node_modules
See where your Mac's space went
Diskzy maps your disk, explains System Data and clears what's safe. Free for 72 hours, then $9 once for 2 Macs.
Try Diskzy for free