How to Clean Bun & pnpm Cache on Mac
Modern package managers like Bun and pnpm use global stores to avoid duplicating files across node_modules. However, over time these content-addressable stores accumulate gigabytes of old package versions that no active project references. Here is how to prune them safely.
Where Bun and pnpm Store Cached Files on macOS
Both tools store global cache artifacts outside of your project directory:
- pnpm global store:
~/Library/pnpm/store/v3(or hardlinked root volume) - Bun package cache:
~/.bun/install/cache
# Check current disk space used by pnpm and Bun stores: pnpm store path du -sh $(pnpm store path) 2>/dev/null du -sh ~/.bun/install/cache 2>/dev/null1. Pruning Unused Packages from pnpm Store (10–25 GB)
pnpm uses hard links from a single content-addressable store. When you delete a project folder, the hard links in the project are gone, but the package tarball files remain in the global store indefinitely.
# Safely remove only unreferenced packages: pnpm store prune # View current store status and modified files: pnpm store statusSafety guarantee: pnpm store prune only deletes files that are not referenced by any project currently on your drive. It never breaks active projects.
2. Clearing Bun Package & Runtime Cache (5–15 GB)
Bun caches npm registry tarballs, binary bindings, and pre-compiled TypeScript artifacts. You can safely clear this entire directory:
# Built-in Bun cache prune command: bun pm cache rm # Or manually clear the cache directory: rm -rf ~/.bun/install/cacheBun will re-download only what is needed during your next bun install.
3. Clean Dormant node_modules with SpaceWise (1-Click)
Even with global stores, individual projects still contain symlinked or generated artifacts (.next, dist, .turbo) that consume 30–80 GB across your drive.
SpaceWise automatically scans your filesystem for inactive repositories (30+ days untouched) and lets you prune heavy dependency directories with one click:
- ✓Lockfile inspection: Ensures package.json and lockfile exist before deletion.
- ✓Trash guarantee: Files are relocated to OS Trash so you can undo anytime.
- ✓Instant recovery: Run
pnpm installorbun installto restore instantly.
Do all of this in SpaceWise — for free
SpaceWise scans and safely cleans everything covered in this guide with one click. No Terminal required.
Download for Mac Free