How to Remove Temporary Items & Bloated /private/var/folders/ in Mac OS X the Safe Way
Mac OS creates various system level folders of temporary items and caches, which typically remain hidden from the average Mac OS X user. Nonetheless, Mac users using various disk management utilities and apps like OmniDiskSweeper will come across these various temporary item folders in Mac OS X, often at locations like /tmp and /private/var/ and /var/folder. Sometimes the items in these directories can be huge and take up dramatic amounts of disk space, which leads many Mac users wondering if they can safely delete the contents of the various /private/ folders.
For example on this particular Mac which is rarely rebooted, OmniDiskSweeper has discovered some large files hanging around buried deep in one of these temporary system folders of /private/var/folders/ further buried in /g7/7p9s/T/TemporaryItems/, with those many temporary items eating up a grand total of 44GB of disk space, hardly a soft footprint:
How to Remove Temporary Items from Mac System Folders
You want those files removed so you can regain that disk space, obviously. What should you do? Should you delete the files yourself? Is it possible to clear them out? The answer to this is both NO and YES, NO you should never clear those temporary cache items yourself, but YES you can have Mac OS clear out the temporary files itself. This may sound confusing but it’s really not, and getting Mac OS X to clean house and ditch those potentially enormous files is really simple.
NO, you should never manually delete items in the system temporary folders
The /tmp, /private, /var, /var/folder directories should never be manually adjusted, modified, or otherwise changed by the user in anyway. There are rare exceptions to this with very specific circumstances for advanced users who backup, but for 99% of the cases, no user involvement should happen in these system level temporary directories. No, do not go into those folders and delete files even if they are large, you should should never manually intervene in these directories. Doing so may damage your Mac OS installation and may prevent OS X from booting or behaving as expected.
OK so what if you have 40GB of temporary garbage stored in these folders, you want to remove that data obviously, how should you get Mac OS X to ditch the temporary files it is holding onto? Can you remove the temporary data another way?
YES, you can clear out those temporary folders by letting Mac OS X perform regular functionality
Yes, you can get those temporary /private and /tmp folders to clear their contents by allowing OS X to run through it’s own typical maintenance routine.
Do not manually delete items in /private/var/ or /var/folders, you could break something or cause a problem with Mac OS X.
So what’s the trick to delete these files and have Mac OS clean house on it’s own?
How to Safely Clear Temporary Items & /private/var/folders/ in Mac OS X
The solution to remove temporary items in Mac OS X is remarkably simple: reboot the Mac.
- Save whatever you are working on
- Pull down the Apple menu and choose “Restart”
- Reboot the Mac, the temporary system folder items and caches will be cleared automatically on boot
Simply rebooting the computer is usually enough to clear out the entire bloated temporary section of Mac OS system files.
By rebooting the Mac, you will trigger the built-in cache clearing functions of Mac OS X upon boot and the unnecessary contents, caches, and temporary items in /private/, /var/, and /var/folders/ will delete themselves as deemed necessary by the Mac. This allows the OS to sort through the temporary files and caches and determine what is needed and what is not, which will clear out the vast majority of the stuff that has built up in there, particularly if the Mac hasn’t been rebooted in a long time, if you’ve uninstalled a ton of apps recently, or have performed a variety of other system actions.
If for some reason you reboot the Mac and the temporary files and tmp folders are still bloated with who knows what, you can reboot into Safe Mode by rebooting the Mac and holding down the Shift key, this performs additional measurements to get rid of temporary files and caches, when the Mac has finished booting into Safe Mode, rebooting back as usual should get things in check as expected.
And if you came across these folders because you’re running out of storage, check out some tips to free up disk space on the Mac, or do a file size based search, you’ll likely find something appropriate for recovering some space for your situation.