Free up disk space on a Mac (developer edition)
Caches, old dependencies and Docker images quietly eat tens of gigabytes. Find them and clean them safely.
See how full the disk is
Check the Avail column for /.
df -hFilesystem Size Used Avail Use% Mounted on /dev/sda1 98G 61G 33G 65% /
Find what’s big in your home folder
Run this from ~ to see the biggest folders.
du -sh * | sort -h4.0K README.md 120M dist 1.4G node_modules
Clean Homebrew
Removes old versions and the download cache.
brew cleanup --prune=allClean Docker
Check first, then prune unused images and build cache.
docker system dfTYPE TOTAL ACTIVE SIZE RECLAIMABLE Images 23 4 9.8GB 7.1GB (72%) Build Cache 188 0 3.2GB 3.2GB
Delete old node_modules
Run from your projects folder. Each project reinstalls with npm install.
find . -name "node_modules" -type d -prune -exec rm -rf {} +Deletes folders permanently. Run it from your projects folder, not from / or ~.
Clear the npm cache
Often several gigabytes.
npm cache clean --force