What I use to recover Mac OS X space

Many times, especially after long usage, Mac OS X eats up a lot of space. In the latest version, macOS Sierra, they even included a “Storage manager” to help you clean unused files. This is great, and a step forward, but I have found most of my space gets lost in temporary files.

Determine what’s causing the issue

The basic OS X storage scanner shows you Applications, Photos, Videos, etc and System section. Unfortunately no actions are available in the System section so here’s what I’ve done:

I scanned the storage using a small app called “OmniDiskSweeper” which allowed me to find the root of lost storage. In my case the largest folder ( sometimes over 80gb ) was /private/var/tmp.

Reading around the internet some people say it’s bad practice to delete anything there as it may cause issues with your programs or lose unsaved data. I highly recommend making a backup before proceeding further.

Because the computer was sluggish and I thought freeing some space will make it faster ( which was actually true ) I decided to empty it!

So I used:
rm -rf *.xt

Use with caution & note that it might break some running programs. Although I must confess – it never did for me, I usually save my work, close all the apps and run the command above. I’ve used it 10 times until now with no issues.

Also please note this might not be the issue on your system so it’s not always this problem.

Why this happens?

From my reading I found that OS X runs a cron which should delete temporary files older than 3 days. I suspect that some of the programs I use, especially for local development, continuously use large temporary files which never get to the 3 days cue.

Another suspicion I have is that it’s a permissions issue, I tried running a “repair permissions” from the Disk utility on the recovery partition but I saw no improvement.