You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Is it ok to delete the contents of /private/var/folders/*?

I'm doing some major maintenance of my Macbook at the moment, and so far that has included running Onyx and Cocktail, and I'm not in the process of defragmenting files and free space with TechTool.

In the process of defragmenting files, a few files called "daily.out" cropped up as fragmented and large. They were contained inside a folder called /private/var/folders.


On inspecting this folder, it would seem that all of its contents are subfolders with "cache" or "tmp" in them. I assume these are all temporary files and caches, using my incredible genius discerning skills. 😉


Question is, can I safely just trash the entire contents of this /folders/ directory? Some of these caches and logs have grown to gigantic sized, the entire folder is about 200MB at this stage, and they remain even though I used Onyx and Cocktail to clear out caches.

Can anyone tell me, exactly what is this directory used for and which caches are they? They're obviously not the same caches as you find in /Library/Caches or ~/Library/Caches/, so what's the difference? Can they safely be gotten rid of?


When running cocktail, one of the options is to ignore the caches of audio units and such, I work often with DAWs so I was just wondering, what good does a "cache" do for these plugins, and why wouldn't you want to clear them from time to time?


I'm really hoping I can somehow get rid of these files safely as I'm trying to revert my machine to the speed it was at a few months ago when I had just newly installed Snow Leopard.

Is it safe?


EDIT: Also I did a full and complete backup of my entire HD using Carbon Copy before I started my maintenance session so I'm ok with taking risks, if there's a slight possibility of this causing problems. I'd just like to know what might happen first.

Posted on Feb 23, 2012 9:47 AM

Reply
28 replies

Aug 13, 2017 12:17 AM in response to hatrickpatrick

Yes, it is ok to delete the contents of /private/var/folders/ (and then reboot)


/private/var/folders/ contents was created for sandbox caching. It's contents, like any cache, can and does become corrupted at times. The corrupted contents of /folders has been known to cause Spotlight indexing to take days, sometimes never completing. Others have seen their boot times increase dramatically after the deletion of the contents of /folders


Unix is fast if the file system is fast, is flakey if the system is flakey. A corrupted cache is like kryptonite to Unix. (aka macOS)


Delete the contents of /private/var/folders/ at will and then reboot. It does not hurt a thing and you might find your Mac acts like the machine you originally purchased.

Feb 23, 2012 9:56 AM in response to hatrickpatrick

/var is a standard directory of any Linux/UNIX system - it stands for "variable" and is a place where a lot of logs, cahces, BUT also program variable settings files and even some system configuration databases reside.


You should be very careful about just deleting things in any of the hidden system folders, especially if you are thinking of just deleting whole directories (and you probably do not have permission for many of those, even as admin, as they will be specifically owned by root).


Most things in /var should be properly purged and regulated by the system. Your swap files for virtual memory also live in /var so don't mess with that. /var/run also holds a lot status and parameter information of actively running process daemans.


/var may very well get large at times - if you are using a lot of swap, for example, or /var/tmp may fill up with temp files during a long session with a single app and many files. But, for the most part, the system will handle cleaning up when necessary, and if you delete things yourself, you are highly likely to get unexpected and highly undesirable results.

Feb 23, 2012 10:01 AM in response to Michael Black

I'm aware of the importance of /var/ and the foolishness of messing with it.

However I'm also aware of what most of the folders inside it are for. /folders/ is new to me, and as it seems to only be cache and tmp files, I was wondering what exactly it is, and what it's used for. Any ideas? I've tried googling it but there's not much info, except a bunch of others like me complaining that its size is ballooning...

Feb 23, 2012 11:59 AM in response to hatrickpatrick

To my memory, /var/folders came to being with OS X 10.5 as a more obscure place for what used to be

/Library/Caches. And instead of being world read/writeable, it should now be user specific.


It should be safe to clear out if you've closed whatever you had running. Safari seems to be a big culprit for writing there, caching junk from every web page you visit. I have read that some systems monitoring tools are also notorious for filling it up (they cache data for logs supposedly).

Feb 23, 2012 12:11 PM in response to hatrickpatrick

Do not tamper with /var in any way. If you want to get some space back then reboot. The system will clear out what it deems needs clearing out. That includes your swap space which may build up over time if you don't reboot and have insufficient ram.


Erase stuff in there at your own risk.


As for /var/folders, I don't think you can remove any of that stuff anyhow since I think you have to log in as "root" to remove it.


Also note, if you are so low on disk space that you are concerned about just 200MB then IMO you are headed for bigger problems anyhow. You should always leave about 20GB to 25GB just for the OS to operate efficiently.

Feb 23, 2012 6:42 PM in response to hatrickpatrick

hatrickpatrick wrote:


Some of these caches and logs have grown to gigantic sized, the entire folder is about 200MB at this stage, and they remain even though I used Onyx and Cocktail to clear out caches.

IMHO, you're looking for headaches. My </var/folders> is >400MB (real size, not Finder's) and I haven't noticed any slowdown. As X423424X says, 200MB is nothing -- certainly not worth the time it took you to write your OP. FWIW, my advice is, leave </var> severely alone. If your system is slowing down, look elsewhere. Start by doing a simple Safe Boot followed by a normal boot.


<http://support.apple.com/kb/HT1564>

Feb 23, 2012 8:26 PM in response to hatrickpatrick

Even if you were to save some disk space by deleting those files, they will get recreated fairly soon anyway. You can delete the daily.out file, for example, safely, but it will just get recreated during background system maintenance.


On my Macs, by far the biggest space hog in the /private/var areas is the sleepimage file inside /private/var/vm and that is a file you do not want to delete. It's the file that all the contents of your memory is written to when you put your Mac to sleep. On my laptop it is 4 GB in size (equal in size to the amount of RAM), so deleting 200 MB here or there pales in comparison.

Jan 12, 2013 5:32 PM in response to hatrickpatrick

It's and old post but still useful.


Yes, you can delete the contents safely but it isn't important to do so. Don't delete anything else in /var/ and you will be fine. It won't do you any good, however, so just leave it alone.


Onyx, Cocktail, "cache cleaning" and "defragging" apps are a waste of time and money and won't do you any good either. Nothing will go faster. Apps running in the background slow you down, like antivirus and maintenence software. Caches speed things up, that's their function. This software you have seems to be helping and making your mac better, but are ultimately worthless and I've administered many severe duty Macs. Kind of the way your car feels faster after an oil change. It ain't faster. It's possible for logs to grow out of control, but we have terabyte hard drives for $99 now so what's the real space issue?


Glad to see you digging in system folders. This is good education. Play in there but don't feel you need to delete anything or for pete's sake "clean" anything. That complexity is normal, not something to be feared or changed. Learn about Unix, especially BSD, and get a bigger hard disk.

Jan 12, 2013 9:56 PM in response to GeorgeSupport6411

Not sure how this got bumped after a year 😀

Basically my Macbook is from early 2007 and recently it's been amazingly, mind numbingly slow.

I've deduced that the culprit is my hard drive for one simple reason - paging literally kills it. I know that paging out slows things down, but in my case, I can watch activity monitor and literally the minute I get even a few kb of "swap used", the fans rev up and the entire system just grinds to a halt, and remains so until my next reboot.


Can only assume that the motors on the HD aren't what they once were and can't keep up anymore. So basically I do as much defragging, space clearing etc as I can just to help the disk out in any way I can. Just did another big maintainance, Onyx, Cocktail and Techtool Pro, and I'm running a lot faster.


The problem is two fold essentially - the machine starts dying slowly once it has to page, andSafari 5 has the most appalling memory leak which inevitably leads to paging out after a matter of time, unless you're willing to quit Safari Web Content (thereby force reloading every tab) every couple of minutes. You can tell it's a memory leak bug because once it's finished reloading all pages, the RAM usage by SWC is never even half as high as it was before you quit it :/


Reckon the only way out of this is to get a new Macbook as soon as I can. Don't want to throw that kind of cash around atm but it's looking like pretty soon I won't have any choice

Jan 13, 2013 3:54 AM in response to hatrickpatrick

It's bumped because it still matters so I replied to it. It's now Jan 2012 deleting the contents of /folders/ is still fashionable and so is mucking with so called "maintenance" apps.

That and you still replied :) so you, the OP, feel you still want conversation on this topic. That's fine.

Sorry to say but the maintenance apps you use don't affect paging, or the VM system. The motors on your HD, if dying, will cause error. Your post betrays a fundamental misunderstanding of macOS.

By what mechanism, precisely, is the reason your "big maintenance" is causing you to run faster? Making space on afull HD can cause this but again if you are running out of space (going on a year now) the small amount of cache deleting isn't your long term solution. Defragging, sheesh. Absolutely silly and really senseless if your HD is really failing because defragging is a whole lot of unnecessary HD access.

Instead of getting to the bottom of the issue you made running a bunch of dumb apps part of your routine. Your Mac needs no maintenance only a small amount of free HD space to operate just fine. If you indeed have a runaway log file or rogue app solve that issue instead of deleting /var/folders/ all the time.

Jan 13, 2013 7:29 AM in response to GeorgeSupport6411

In fairness my case might be different in terms of defragmenting.

Apple themselves acknowledge that while OS X does in fact automatically defragment continuously as part of its own background maintenance, it won't handle files bigger than (I think) 30MB, could possibly be 40MB, I can't quite remember.


Problem is that I'm a music producer so I work with absolutely gigantic files a lot of the time, and they are the only files which continuously show up in Techtool as fragmented files. This causes programs such as Garageband and Logic to load them more slowly, and as I say I noticed an instant improvement in response time for those apps as soon as I'd defragmented the files.


The real issue though is that this fragmentation also leads to a lack of contiguous free space on the disk. When this happens, the page file itself gets fragmented, and it seems obvious to me that a fragmented page file will make paging a lot less efficient.


Either way, after running both file and volume defragmentation things are a lot faster. I also rebuiltthe directory which reduced the depth of the B-Tree from 4 to 3, and there's a definite improvement in how quickly finder generates previews and lists the contents of folders.


Finally, I'm afraid the Safari problem has nothing to do with plugins (I don't actually use any most of the time), and Firefox can indeed visit the same websites without eating up my entire available RAM. Have a look around this forum, the fact that Safari has a notorious memory leak is fairly widely acknowledged. You can tell it's a leak since closing every window doesn't result in any RAM becoming inactive, and also that force quitting Safari Web Content and letting it relopad every page usually halves the amount of RAM being used. Clearly the process does not release RAM it was previously using, until it is restarted.


Unfortunate, but manageable.

Jan 13, 2013 8:15 AM in response to hatrickpatrick

We're getting far afield, but if you use a 2007 MBP (with 1GB or RAM and about 150GB drive?) as a music producer with "gigantic files" and you are using defrag apps and deleting the contents of /var/folders/ for speed your workflow is not efficient.

Buy a $99 external Two terabyte USB2 HD for your media and keep some space open on your boot drive. A few GB will do. And get back to work!

But really consider a faster setup for Logic and GarageBand or any media production. Better yet, get a modern Mac Mini for less than a grand with a terabyte HD which is a fantastic solution for music production and will end your current speed issues. You don't need much tech and I have friends that do amazing things musically with 90's era computing technology.

Defraggging is a waste of time, even for your use case. It's frankly indefensible.

Read this (2004) about HFS+ volumes http://osxbook.com/software/hfsdebug/fragmentation.html

(read the whole thing). Remember that things are better now than they were then and it wasn't fruitful then. Furthermore, if you thrash the HD a bunch with a nearly empty drive you are asking for trouble and defragging can't buy you any improvement that lasts past the next big file write. Get a larger drive and keep a bunch of GB open on it is your best solution and frankly it's cheap. Isn't your time (and downtime during defrag) worth money?

It's a bit strange because you know the depth of your B-Tree(!) which is esoteric data and probably printed on the GUI of your defrag app to make you feel like you did something with the app you paid for. Kind of like the oil change sticker Jiffy Lube leaves in your windshield after you paid them $50. Forget that stuff because reducing B-Tree depth doesn't correlate to any speed increase directly and doesn't have any effect you can feel.

I'm starting to think all of your mucking with your boot drive's directory structure and file structure over the last year has created an oddball issue.

Compressing the directory structure to reduce your B-Tree depth is about the silliest thing I've heard. You know enough to be dangerous.

Jan 13, 2013 8:31 AM in response to hatrickpatrick

You Windows converts are crazy. You don't need to defrag for your use case, cache cleaning does not replace registry cleaning, your Mac does not need periodic maintenance, and there are no viruses only trojans (stop downloading and installing stuff!)

If you have a specific problem, don't make it worse by guesssing. Troubleshoot and fix the issue.

Is it ok to delete the contents of /private/var/folders/*?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.