Developer disk hogs: Gradle, npm, node_modules and the caches that never go away
Most developers have lost 20 or 50 GB without noticing. Build tools are built to be fast, so they keep everything they ever downloaded or compiled. Nothing expires, and nothing is cleaned when you finish a project. The files are not hidden on purpose: they sit in dot-folders in your home folder and inside every old project.
The usual places
| Tool | Where the cache lives | Safe to delete? | Find it / clean it |
|---|---|---|---|
| Gradle | ~/.gradle/caches, ~/.gradle/wrapper/dists (Windows: %USERPROFILE%\.gradle) | Yes. Downloaded again on the next build, slowly. | gradle --stop first, then delete the folders. Old wrapper versions pile up in wrapper/dists. |
| npm | ~/.npm (Windows: %LocalAppData%\npm-cache) | Yes | npm config get cache, npm cache clean --force |
| pnpm | one content store, often ~/.local/share/pnpm/store or ~/Library/pnpm/store | Yes, but projects are hard-linked to it | pnpm store path, pnpm store prune |
| Yarn | yarn cache dir shows it | Yes | yarn cache clean |
| node_modules | inside every project, often 200 MB to 1 GB each | Yes. npm install brings it back. | Delete it in projects you are not working on |
| Maven | ~/.m2/repository | Yes, but a slow first build offline | Delete the folder, or only old versions |
| Cargo (Rust) | ~/.cargo/registry and a target/ folder in each project | Yes | cargo clean in a project removes target/ |
| pip / Python | pip cache dir; each project's .venv | Cache yes; a venv can be rebuilt from requirements | pip cache purge |
| Go | ~/go/pkg/mod | Yes | go clean -modcache |
| Xcode (Mac) | ~/Library/Developer/Xcode/DerivedData, iOS DeviceSupport, Archives, CoreSimulator | DerivedData yes. Keep Archives you may need to symbolicate. | xcrun simctl delete unavailable removes simulators you can no longer run |
| Android | ~/.android/avd (emulators), the SDK's old system-images and build-tools | Unused emulators and old images yes | Android Studio's SDK Manager and Device Manager |
| Flutter / Dart | ~/.pub-cache | Yes | dart pub cache clean |
Why you have several of them
Node is the worst case. You can end up with an npm cache, a pnpm store, a Yarn cache, a Bun cache and a copy of node_modules in every project, each holding the same packages. Version managers like nvm, fnm and Volta each keep every Node version you ever installed too (~/.nvm/versions, for example). Delete the Node versions you no longer use first; they are often 100 MB or more each.
How to find the big folders
On a Mac or Linux, run du -sh ~/.* 2>/dev/null | sort -h | tail to see the biggest dot-folders in your home folder. To find old project folders: find ~ -name node_modules -type d -prune. On Windows, open Settings, System, Storage, or use a tool that lists folder sizes. Look at %USERPROFILE% and %LocalAppData% first.
Before you delete
- Stop the daemons: Gradle and Kotlin keep background processes alive after a build (
gradle --stop). - Never delete a cache while a build or an IDE sync is running.
- Anything you cannot download again (private packages from a registry you no longer have access to, signed archives) is not a cache. Check first.
- Expect the next build to be slow, because it downloads everything again. Do the cleanup when you are not on a deadline.
Where Zofle fits. Zofle is a free disk cleanup and file finder for Mac and Windows. It shows what is filling a disk, folder by folder, lists developer caches, old build folders and leftovers with their size and date, lets you untick what you want to keep, and sends the rest to the Trash or Recycle Bin first so you can undo it.
Sources and method
- Gradle documentation: build cache and Gradle User Home (docs.gradle.org).
- npm documentation:
npm cache; pnpm documentation:pnpm store. - Apple developer documentation: managing Xcode's derived data and simulators (
xcrun simctl help). - Paths and commands are from each tool's own documentation and can differ by version; run the 'find it' command on your own machine before deleting anything.
Zofle Pro news
People signing up now will get Zofle Pro, with more features, for free when we launch it.