My Mac was almost full. It said that “Documents” used 39 GB, but I didn’t know what was taking so much space. As a software developer, I have tools like npm, Docker, and Homebrew that keep files to work faster. These files can get very big. Here’s how I fixed it.
Step 1: Look at Documents
I checked my Documents folder in Finder, but the files there were much smaller than 39 GB. Then I used Terminal:
du -sh ~/Documents/* | sort -h
This shows the size of each file and folder. Most were small. So the big files were hidden in caches and tools.
Step 2: Clear developer tool caches
- npm (Node.js)
du -sh ~/.npm
npm cache clean --force
This freed 3.5 GB.
- Docker
docker system df
docker builder prune
My Docker cache alone was 19 GB!
- Homebrew
du -sh ~/Library/Caches/Homebrew
brew cleanup
This cleared hundreds of MBs.
- VSCode
rm -rf ~/Library/Application\ Support/Code/Cache/*
rm -rf ~/Library/Application\ Support/Code/CachedData/*
rm -rf ~/Library/Application\ Support/Code/User/workspaceStorage/*
This freed about 5 GB.
Step 3: Remove old tools you don’t use
I had old versions of PHP and some apps I didn’t use. I removed them:
brew uninstall php@7.1 php@7.4 php@8.0
brew uninstall --cask fig
brew uninstall nginx
Step 4: Check other caches
Other tools also store caches:
- Python pip:
~/.cache/pip
- Go modules:
~/go/pkg/mod/cache
- iCloud:
~/Library/Mobile Documents
You can check their size with:
du -sh <folder>
Step 5: Keep it clean
I now run these commands every few weeks:
npm cache clean --force
docker builder prune
brew cleanup
rm -rf ~/Library/Caches/*
This keeps my Mac from filling up again.
Lessons learned
- Most big storage is hidden in caches, not in Documents.
- Tools like Docker, npm, Homebrew, and VSCode can use lots of GB.
- Cleaning regularly can free 20–40 GB.
- Terminal commands like
du -sh
anddocker system df
help find big files.
With these steps, my Mac now has plenty of space and runs better.
Top comments (0)