Sweep

← All posts

Reclaim gigabytes of developer junk on your Mac

· 2 min read

If you write code on a Mac, the biggest space hogs are often not your files at all. Build products, dependency folders and caches pile up project after project, and none of them show up as one big item in Finder. The good news: almost all of it can be rebuilt, so it is safe to remove once you know what it is.

node_modules

Every JavaScript project carries its own copy of its dependencies, often several hundred megabytes. Old side projects you have not opened in months are the easiest win: the folder comes back with npm install when you need it.

find ~/Projects -name node_modules -type d -prune -exec du -sh {} + | sort -h

Xcode: DerivedData, archives and simulators

xcrun simctl delete unavailable

Docker

Images, stopped containers and build cache grow quickly. See what is using space, then prune what is not in use:

docker system df
    docker system prune

Add --volumes only if you are sure no volume holds data you need, such as a local database.

Package manager caches

Caches only make the next install faster; removing them costs a re-download, nothing more.

Don't forget the Trash

Moving folders to the Trash does not free space until you empty it. That is a feature: if a build breaks after cleaning, you can put things back.

Where Sweep helps

Sweep for Mac, Windows and Linux finds these folders for you, shows how big each one is and when it was last used, and moves what you pick to the Trash rather than deleting it outright (for a few caches it runs the tool's own clean command instead, such as npm cache clean, and says so first). Its Ports view also lists dev servers still listening on ports such as 3000, so you can stop the one you forgot.