Spring cleaning: Reclaiming hidden disk space on Mac

Recently a few people on our team started running low on disk space — always a precious commodity with MacBooks. Chatting in our #random Slack channel, we swapped stories and came up with a few lesser known tricks to reclaim this space.

Our team was able to collectively save almost 220 GB using these 3 methods, so we thought it would be worth sharing. Of course, your mileage may vary.

Clear document versioning

Recent releases of macOS include a Versioning feature which stores past copies of saved files, in case you ever want to revert to a previous version. This is handy, but for graphics-heavy programs like Sketch, it can also eat up a lot of disk space.

You’ll find these files in a hidden folder at the top level of your Macintosh HD (/.DocumentRevisions-V100).

To see how much space this folder is currently using, run the following command:

$ sudo du -sh /.DocumentRevisions-V100

To clear this folder (and all past document versions), run:

$ sudo rm -rf /.DocumentRevisions-V100

The folder will be safely rebuilt by the OS, but you can also disable this feature entirely if you prefer.

“I cleared almost 200 GB of disk space by cleaning that folder.” -Justin

Cleanup Homebrew

If you use the popular Homebrew package manager, note that it does not uninstall old package versions by default. Over time you will accumulate old versions.

To remove out of date packages, simply run:

$ brew cleanup

“Saved me 14 GB a few weeks ago.” —Ethan

Remove unused NPM packages

Node modules installed by NPM can add up over time. To see how much space your various node_modules folders are taking up, you can run:

$ find . -name "node_modules" -type d -prune \
    -exec du -sh "{}" + | gsort -hr

Once located, you can delete or prune any unused folders.

Or if you are daring, you can remove all node modules in one fell swoop (use at your own risk):

$ find . -name "node_modules" -type d -prune \
    -exec rm -rf "{}" +

“Reclaimed ~5 gigs of space.” —Adrian


Have other tips to add? Let us know on Twitter @oakstudios.


Recent posts

⚡ View all posts