I freed 12GB of disk space in 10 seconds with one CLI command

Published: (March 8, 2026 at 08:12 AM EDT)
5 min read
Source: Dev.to

Source: Dev.to

Disk Almost Full? Your Dev Tools Are Probably to Blame

You know that “disk almost full” notification that pops up right when you’re in the middle of something important? Yeah, that one.

I used to spend 20 minutes hunting down what was eating my disk. Turns out the answer was almost always the same: my own dev tools.

Your dev machine is silently hoarding gigabytes of junk

A dirty secret nobody talks about at stand‑up: every project you’ve ever cloned, built, and forgotten about is still sitting on your disk, quietly consuming space.

  • That side project from January? Its node_modules is still there.
  • That Rust experiment you tried for a weekend? The target/ folder is 800 MB.
  • Those three Docker tutorials? Dangling images galore.

And the worst part is that every tool has its own cleanup command:

rm -rf node_modules                # per project, manually
docker system prune                # Docker
brew cleanup --prune=all          # Homebrew
pip cache purge                   # Python
cargo clean                       # Rust, per project
rm -rf ~/Library/Developer/Xcode/DerivedData  # Xcode
npm cache clean --force           # npm

Seven different commands. Some need to be run per‑project. Some you forget exist. None of them give you a clear picture of how much space you are actually wasting.

I got tired of this, so I built something.

Meet devclean – one CLI that scans and cleans everything

devclean is a single command that finds all the reclaimable space across your entire dev environment and lets you clean it in one shot.

Install

npm install -g devclean-cli

Scan

devclean scan

No config, no setup, no flags required. It walks your home directory and finds everything.

What a real scan looks like

$ devclean scan

  devclean — scanning /Users/you

  Scanning node_modules... found 23 (4.7 GB)
      1.2 GB  142d ago  ~/old-client-project/node_modules
      891.0 MB   98d ago  ~/freelance-2024/node_modules
      620.3 MB   67d ago  ~/hackathon-app/node_modules
      ... 20 more

  Scanning Cargo targets... found 2 (1.2 GB)
      803.4 MB  ~/rust-playground/target
      421.1 MB  ~/cli-tool-experiment/target

  Scanning package manager caches... found 2 (890.0 MB)
      540.2 MB  npm cache — ~/.npm
      349.8 MB  yarn cache — ~/Library/Caches/Yarn

  Scanning Docker... found 3 item(s)
      5 dangling image(s)
      2 stopped container(s)
      Docker system (use docker system prune)

  Scanning Homebrew cache... 2.1 GB
        2.1 GB  ~/Library/Caches/Homebrew

  Scanning Xcode DerivedData... 3.4 GB
        3.4 GB  ~/Library/Developer/Xcode/DerivedData

  Total reclaimable: 12.3 GB
  Run devclean clean to free this space

12.3 GB—just sitting there, doing nothing. Twenty‑three node_modules folders from projects you haven’t touched in months, Cargo build artifacts from a language you were “just trying out,” Homebrew downloads for packages installed six months ago.

Preview before you delete

Not ready to pull the trigger? Use --dry-run:

$ devclean clean --dry-run

  devclean dry run

  [dry-run] Would delete 1.2 GB  ~/old-client-project/node_modules
  [dry-run] Would delete 891.0 MB  ~/freelance-2024/node_modules
  [dry-run] Would delete 620.3 MB  ~/hackathon-app/node_modules
  ...
  [dry-run] Would delete 803.4 MB  ~/rust-playground/target
  [dry-run] Would clean npm cache
  [dry-run] Would run docker system prune
  [dry-run] Would clean Homebrew cache
  [dry-run] Would delete 3.4 GB  ~/Library/Developer/Xcode/DerivedData

  Dry run complete. No files were deleted.

Nothing gets touched. You see exactly what would happen.

Clean only what you want

Maybe you only care about node_modules right now. No problem:

devclean clean --node-modules

Or just Docker:

devclean clean --docker

Or a specific directory:

devclean clean -p ~/projects/2024

Every target has its own flag, so you stay in control.

Protect active projects with --older-than

This is my favorite flag. If you’re worried about cleaning node_modules for a project you’re actively working on, add an age filter:

devclean clean --older-than 30

Only items that have not been modified in 30 + days are deleted. Your current projects are untouched. That project from three months ago that you’ll “definitely get back to”? Gone. You can always npm install again in 15 seconds.

I run this on a cron job every week:

devclean clean --older-than 60

Set it and forget it. My disk never fills up anymore.

What it cleans

TargetWhat it findsHow it cleans
node_modulesAll node_modules/ folders across your projectsrm -rf
DockerDangling images, stopped containers, build cachedocker system prune
HomebrewDownloaded package cachebrew cleanup --prune=all
pipPython package download cachepip cache purge
CargoRust target/ build directoriesrm -rf
XcodeDerivedData build cacherm -rf
npm / YarnPackage manager download cachesnpm cache clean / yarn cache clean

Important: devclean scan is always read‑only. It never deletes anything. You have to explicitly run devclean clean to remove files, and it only touches well‑known cache and build directories—never your source code.

Installation & usage recap

npm install -g devclean-cli
devclean scan                 # see what's eating your disk
devclean clean --dry-run      # preview the cleanup
devclean clean                # free the space

Works on macOS and Linux. Requires Node.js 16+.

Why I built this

I have been a developer for years and I still catch myself running out of disk space every few months. The fix is always the same: delete a bunch of node_modules, prune Docker, clear some caches. It takes 10‑20 minutes of typing commands I have to look up every time.

devclean turns that into one command that takes 10 seconds.

If this sounds useful to you, give it a try. And if you like it, a star on GitHub goes a long way.

How much space did devclean scan find on your machine? Drop the number in the comments. I bet it is more than you think.

0 views
Back to Blog

Related posts

Read more »