How to Clean Up Developer Storage: Delete Gigabytes of Gradle, NPM & Docker Caches

Where Did All Your Hard Drive Space Go?

Software development generates significant cache volume. Between Android Studio Gradle wrapper caches, redundant node_modules directories, Docker image layers, and pip wheels, developer SSDs frequently run out of space. Here is how to reclaim 30GB to 80GB safely without breaking your active development environments.

1. Reclaiming Space from Android Gradle Caches (10GB - 30GB)

Gradle caches every historical wrapper JAR and unpacked dependency inside ~/.gradle/caches. Over time, abandoned versions accumulate:

# Stop all running background daemons first
./gradlew --stop

# Delete stale caches (Gradle will re-fetch current project dependencies on demand)
rm -rf ~/.gradle/caches/
rm -rf ~/.gradle/daemon/

# On Windows PowerShell:
Remove-Item -Recurse -Force "$env:USERPROFILE\.gradle\caches"
Remove-Item -Recurse -Force "$env:USERPROFILE\.gradle\daemon"

2. Purging Dormant Docker Layers (15GB - 50GB)

Dangling images, stopped containers, and unused build caches consume substantial disk space:

# Remove all stopped containers, unused networks, and dangling images
docker system prune -a --volumes -f

3. Cleaning Global NPM, Yarn & Pip Caches

# Verify and purge NPM cache
npm cache clean --force

# Yarn cache clean
yarn cache clean

# Pip cache purge
pip cache purge

4. Batch Cleaning Abandoned node_modules and build Folders

Use modern CLI tools like npkill to visually inspect and delete massive node_modules folders across old, archived projects:

npx npkill

This tool scans your selected directory and allows instant deletion of inactive dependency trees with a single keystroke.

Share this Guide Help colleagues and developers learn from this article
In-Article Sponsored Content
Mohit Kumaar
AUTHOR & FOUNDER

Mohit Kumaar

Founder & CEO of JMD WORLD with 8+ Years of industrial software engineering leadership (active since 2018). Creator and manager of 500+ production Google Play applications (proprietary & client solutions) and architect of apps.jmdworld.in. Operating from Pune & Mumbai under MSME Registration: UDYAM-MH-26-1071218 and D-U-N-SĀ® 581707246.

Previous Guide

Room Database Architecture: Offline-First SQLite Caching in Modern Android Apps

development
Next Guide

Android WorkManager Masterclass: Reliable Background Sync & Battery Optimization

development
Recommended For You Ads by Google

Comments (0)

No comments yet. Share your thoughts below!

Leave a Comment

Share your thoughts or questions. Your email address remains private.