Quick answer
Run bun pm cache rm to clear the Bun cache. It deletes the global install cache (~/.bun/install/cache by default) and leaves your projects working; the next bun install downloads what it needs again. To remove only packages older than 30 days, run bun pm cache prune.
Where the space goes
Clear the Bun cache
Bun has a built-in command for this. It removes the whole global install cache:
bun pm cache rm
# See what it would delete first:
bun pm cache rm --dry-runProjects that are already installed keep working, because their node_modules folders are not touched. The next bun install re-downloads only the packages that project needs.
Where the Bun cache is on Mac
Ask Bun for the exact path, then check how big it is:
bun pm cache
# /Users/you/.bun/install/cache
du -sh "$(bun pm cache)"The default is ~/.bun/install/cache. It is somewhere else if any of these are set:
- the
BUN_INSTALL_CACHE_DIRenvironment variable dirunder[install.cache]inbunfig.toml- the
--cache-dirflag onbun install
Remove only old packages
Recent Bun versions can prune the cache instead of emptying it. This keeps packages you used recently, so your next installs stay fast:
# Remove packages older than 30 days (the default):
bun pm cache prune
# Pick your own age, and preview first:
bun pm cache prune --max-age 7 --dry-runbun pm cache prune is not recognised, your Bun is older. Update with bun upgrade, or use bun pm cache rm.Install without the cache
If you suspect a bad cached package, you do not need to clear everything:
# Ignore the cached package manifests for this install:
bun install --no-cache
# Re-fetch and reinstall every dependency:
bun install --forceWhere the bigger wins are
The Bun cache is usually a few gigabytes. The project folders it fills are usually much bigger: every repo has its own node_modules, plus build output like .next, dist and .turbo.
SpaceWise scans your drive for those folders in repos you have not touched in a while, shows their size, and moves the ones you pick to the Trash so you can undo. The free version scans without limits.
FAQ
How do I clear the Bun cache?
Run bun pm cache rm. It deletes Bun's global install cache (~/.bun/install/cache on Mac by default). Your projects keep working; Bun re-downloads packages on the next bun install.
Where is the Bun cache on Mac?
Run bun pm cache to print the path. By default it is ~/.bun/install/cache. It moves if you set BUN_INSTALL_CACHE_DIR, the [install.cache] dir option in bunfig.toml, or pass --cache-dir to bun install.
Is it safe to delete the Bun cache?
Yes. It only holds downloaded package tarballs and metadata. Installed node_modules folders are not touched. The only cost is that the next install downloads packages again.
How do I clear only old packages from the Bun cache?
Recent Bun versions have bun pm cache prune, which removes packages older than 30 days. Change the age with --max-age <days>, and add --dry-run to see what would go first.
How do I install without using the Bun cache?
Use bun install --no-cache to ignore the manifest cache for one install, or bun install --force to re-fetch and reinstall every dependency.
Run this cleanup in SpaceWise
Same targets, Recovery Bin rollback, no Terminal required. Free tier included.