DEV Community

pixent interactive
pixent interactive

Posted on

How I reclaimed 47GB on my MacBook by cleaning developer project junk

Last week I ran out of disk space mid-deploy. That annoying "Your startup disk is almost full" notification. I had a 512GB MacBook and somehow had less than 8GB free.

So I started digging. What I found surprised me.

The culprits

Here's the breakdown of what was eating my storage:

node_modules — 18GB

Every JavaScript project has one. They're never small. A typical React project pulls in 300–500MB of dependencies. I had projects from 2021 I'd completely forgotten about — each one with an intact node_modules folder taking up space.

The good news: they're completely safe to delete. npm install (or yarn, or pnpm) regenerates them instantly.

Unity Library folders — 14GB

If you've ever used Unity — even just for a game jam or a tutorial — your project has a Library folder. Unity uses it as a local cache for imported assets. It regenerates automatically when you open the project.

I found four old game jam projects I'd abandoned. Combined Library size: 14GB.

Xcode DerivedData — 9GB

Xcode stores build artifacts, indexes, and intermediate files in ~/Library/Developer/Xcode/DerivedData. It grows silently over time. Mine had build caches from apps I no longer maintain.

Safe to delete via Xcode → Preferences → Locations → DerivedData → arrow button. Or just nuke the folder directly.

Python virtualenvs — 6GB

Every python -m venv or conda create leaves behind an isolated environment with its own Python installation and packages. I had virtualenvs from tutorial projects dating back to 2020.

The fix

I went through each category manually this time. It took about 40 minutes and recovered 47GB.

After doing this, I built a tool to make it automatic: PolySweeper. It scans your Mac, finds all of these by category, shows the size, and lets you delete with a confirmation step. Runs fully offline — nothing leaves your machine.

If you want to do it manually, here's the quick version:

# Find largest node_modules folders
find ~ -name "node_modules" -type d -prune | xargs du -sh | sort -hr | head -20

# Find Unity Library folders
find ~ -name "Library" -type d -path "*/Assets/../Library" | xargs du -sh 2>/dev/null

# Clear Xcode DerivedData
rm -rf ~/Library/Developer/Xcode/DerivedData
Enter fullscreen mode Exit fullscreen mode

Worth running even if you think your disk is fine. Most developers I know have 10–40GB hiding in these folders.


If you want the automated version: PolySweeper — macOS disk cleaner built specifically for developers. One-time $14.99.

Top comments (0)