Macbook: Other Storage Growing at Insane Rates [duplicate]
I have this folder /private/var/folders/bf/
with 3GB of what seems temporary files. Can I delete this folder?
You can safely delete anything in /private/var/folders/
but not the folder itself
sudo rm -rf /private/var/folders/*
Quit all apps before you do & reboot afterwards … and whatever you do, don't touch anything else in /private/var/
, and do not delete /private/var/folders/
itself.
Rumor has it that one should not delete /private/var/folders/zz
. This article implies otherwise, but if you want to be on the safe side, use
cd /private/var/folders
for i in *; do if [ "$i" != "zz" ]; then sudo rm -rf "$i"; fi; done
sudo rm -rf zz/*
instead.
From a general safety for the system integrity viewpoint:
Anything withinin the hierarchy of /private/var/folders/*
can be deleted. zz
included.
But a restart should reduce the amount of temporary files and data in there anyway.
Quitting well written applications does that too, as should a quick logout-login cycle.
The system will repopulate an empty /private/var/folders/*
after it reboots.
From a practicality and consequences for the users viewpoint:
There is a small catch: it is probably not completely without side-effects to just wipe all and anything under folders
there.
Although theses side-effects are few. Force deleting everything with sudo rm
is possible but not the best option on a live system.
Some of those files might be currently in use. Thus making it difficult or unwise to just delete them all from a running system if one feels the need for that. You'd have to quit the processes using them first. This quitting the process is in itself, as stated above, often enough to have those files removed automatically. If some databases, mainly generated by Apple processes, grow out of hand it might be necessary to move them to the trash, logout-login and then delete them.
A small number of applications or services may store some of the preferences there.
One example is NotificationCenter (NC) with your settings in there: your choice of applications and what of them to be 'in' there. NC rebuilds its preferences with everything in NC enabled. If you have many Apps and prefer most of them to not disturb you this is quite annoying even if only done once.
But then it is not really essential data that gets lost in this way. Since this practice is highly non-standard, it looks only Apple violates its own guidelines: I can't remember any third-party application storing important, not-supposed to be volatile, and non-temporary data in this hierarchy.
Conclusio:
Therefore it is best to locate which of these folders belongs to your most active user, go in there and look for the biggest offenders to delete them manually. It is also prudent to learn which of your apps leave so much stuff behind. Quitting and restarting an actively cluttering app might often be enough to gain some space there. If the second catch is of concern, spare those files related to e.g. NC from deletion.
On Catalina, I have restarted my Macbook in recovery mode (CMD+R at startup). Then, I have opened the terminal to disable the system integrity protection by typing csrutil disable
. Then, I restarted in normal mode. I closed all applications. I ran disk utility and clicked on first aid for my system drive.
Then, I went to /private/var/folders/. It is now 2019 and I have found that some folders weren't modified since 2016 and 2017.
Then, I copied the zz folder content to a USB drive. I went to the zz folder and I deleted all the folders that were not from today. I went to the kt folder, I copied the content in my USB drive and I deleted the folders that were not from today inside the folders 0 and C and T. Before restarting I emptied the trash bin.
I unplugged my USB drive and I restarted in recovery mode, I re activated the system integrity protection, by typing csrutil enable
in the terminal and that's it.
I saved 50GB
For what it is worth (meaning decide worth yourself :-), doing this is dangerous on Catalina (10.15). I did this on a Macbook Air after the upgrade to Catalina. It would not restart, and what a pain to recovery from Time Machine with bad internal screen.
I also had another bad screen Macbook Air (and bad keyboard, and bad trackpad, but I digress). I was paranoid because I use that for development. So instead I found online another trick. Holding the shift while booting make the Mac go into "safe mode". The Mac then booted into safe mode, and "sudo du -d 1 -h /private" confirmed 44GB. After another reboot back into regular Mac OS X and the same command showed 3GB.
BTW, this did not work with a regular keyboard, I had to find an apple keyboard.
Much safer, if a pain, to do that regularly. I tried the free cleaners, but none found those files/folders. And I'd rather not spend $30 - $80 on a cleaner that probably won't find them as well...