23

I have this folder /private/var/folders/bf/ with 3GB of what seems temporary files. Can I delete this folder?

16

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.

  • I used above query: cd /private/var/folders for i in ; do if [ "$i" != "zz" ]; then sudo rm -rf "$i"; fi; done sudo rm -rf zz/ then couldn't boot mac afterward. Had to reinstall the OS. – Aaron Jun 30 '17 at 17:55
  • Did you cd to the correct folder first? Otherwise it would trash some pretty random stuff... – Tetsujin Jun 30 '17 at 18:01
  • of course I went to /private/var/folders first... something other than zz should be preserved I guess. – Aaron Jun 30 '17 at 18:13
  • El Capitan, 2017 June. – Aaron Jun 30 '17 at 18:14
  • tbh, I've never actually tried it - it was just a research & publish, with accreditation. – Tetsujin Jun 30 '17 at 18:54
0

From a general safety for the system integrity viewpoint:

Anything in 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 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.

First: 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.

Second: 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 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.

  • 2
    Somehow the second part of your question contradicts the first. – nohillside Aug 24 '17 at 16:05
  • Could you please define "stuff"? – fd0 Aug 24 '17 at 17:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .