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

Jan 20, 2013 4:52 PM in response to hatrickpatrick

I fuond some stuff that xcode (or something developer-related) had stuck in /var/folders/m1/.. It came up because gcc apparently wouldn't compile a program (that had compiled before - it's Paul Guyot's 'Albert' decompiler/disassembler for the Newton ROM) The following was the command and error:


gcc db2src.cpp disarm.cpp disarm_c.cpp nsDecode.cpp ∂

EasyBMP/EasyBMP.cpp -lstdc++-static -o ../db2src


ld: duplicate symbol _gFnameRomBuilt in ∂

/var/folders/m1/m1JMuhFvE2a7LetqP5+Rpk+++TI/-Tmp-//ccfiL600.o and ∂

/var/folders/m1/m1JMuhFvE2a7LetqP5+Rpk+++TI/-Tmp-//ccFoum78.o ∂

for architecture i386

collect2: ld returned 1 exit status


Jim

Mar 31, 2013 11:43 AM in response to hatrickpatrick

You are talking about a six year old machine. There is a good chance that the disk is slowly dying. (I have a MBP from about that time, and it is slow even in ordinary operations. I have been told by an Apple service centre that the disk is definitely dying.)


It also seems like you might be using every bit of spare space on the disk. Apple recommends keeping at least 10% (from memory) of your disk free at all times. If you don't, the operating system slows down.


I would suggest that it is time to get a new disk for your MBP, which will solve the space problem and the slowness problem. And possibly save you from final failure, probably when you least want it to happen.

Mar 31, 2013 12:51 PM in response to hatrickpatrick

Hear hear !!

quote

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.

unquote

That's it. OSX works totally different than Windows, all these "tools" slow down and wear out your system. Cleaning out caches and temporary files happens automatically on a daily weekly and monthly basis (read how it is described in Onyx).

Feb 17, 2014 8:39 AM in response to Syth

I was brought to this thread by Google having just done a runthrough with WhatSize and also discovered the Private/Var folder - mine is a whopping 9.82GB!!!


Could someone please explain step by step how to reduce this? It's got to be mostly a waste of space... on my mid 2010 MBP happily running OSX 10.8.5


PS Just add - the main huge folder is called 'sleepimage' ... ?!

Feb 17, 2014 9:11 AM in response to musicspirit

Sleepimage is exactly what it sounds like - it is the image written to disc of your machines active state when it went into sleep mode. It is typlically as big as the amount of RAM you have on your system. You can delete it, but the next time your system sleeps, it will just be re-created.


sudo rm /private/var/vm/sleepimage


Try a simple reboot and then see what /var is. Ordinarily, the things that can safely be purged from /var are automatically purged as part of a system restart. However, many, like sleepimage, swap files and so on will just come right back, as they are needed for your system to work properly.

Aug 27, 2014 6:21 PM in response to Richard Glaser

I know this is an old thread, and I've read through some of the links and know the warnings, but has anyone recently seen their /private/var/folders balloon? Mine is approaching 30GB.


I have recently done some hdd maintenance with deleting files (particularly music production libraries that are outdated, I use a lot of DAW software like the OP, including Reason 7, Logic Pro 9 (just deleted), Logic Pro X (just installed), Digital Performer 8 and I'm in the process of removing the bulk of my Native Instruments Kontakt libraries.


I've freed at least 100 gigs of space so far, but on my 500GB hard drive (iMac mid 2011), and I have 32GB ram so I'm not worried about swap space so much, but this folder is showing as very large in Disk Inventory X (which I use now and then just to get a visual idea of what is taking up so much space).


Is there a reason for there to be some files in /private/var/folders that are over 1GB each? That doesn't seem like it would be from Safari...

Apr 6, 2015 3:07 PM in response to JClark5093

I just found a 127Gb file down in /private/var/folders :


-rw-r--r--@ 1 mav6 staff 127G Apr 5 18:48 /private/var/folders/vx/qgwtkrnd56gdpy6rmc84kdhh0000gq/T/com.apple.WebKit.Netwo rking+com.apple.Safari/WebKitGeneratedFile4H5Kh5


Related to Safari apparently. Now trying to find out if it's safe to get rid of it. Already rebooted to see if it would clear it out, but no change.

I'm on Yosemite OS X 10.10.2 .

Searching for answers ...

Apr 7, 2015 9:35 AM in response to marnixva

I found out elsewhere that I could delete everything below /private/var/folders/ after stopping all apps, then use terminal and type in:


sudo rm -r /private/var/folders/*


and then doing a restart. I did this and all that space was recovered and no problems seen. All that content had already been backed up to my time machine drive, but I didn't need it.

Nov 13, 2015 12:38 AM in response to marnixva

There are actually very useful reasons for deleting things in /private/var/folder (/var is a hard link to private/var) a couple of things to mention would be:


1.) This is where 'STUCK' appstore updates or installs are located.

-- Run the command in terminal 'defaults write com.apple.appstore ShowDebugMenu -bool true && killall App\ Store' then re-open appstore and you will see a 'debug' option in your 'File Edit Store...' Menu. If you look at show download folder you will see that there is all sorts of old crap in here (which will cause this directory to get super large, you don't need every update to xcode that you have ever downloaded kept).


2.) This is a tricky place to delete while applications are actively running and sockets are still running on the system because this is one of the default locations that applications write 'in-memory' files.

-- Running the command opensnoop -v -p <PID> on a running process like the default PID of a web browser will show you how intensive this can be.

-- for instance click on Google Chrome then in a terminal window (as root) run the command opensnoop -v -p `ps -ef |grep Chrome|grep -v grep|head -1|awk '{ print $2 }'` will log in STDOUT all these files. Open new tabs and things and witness all the files that are created that are in-memory and you will not be able to see these in finder / find / ls / or even md* commands. lsof will also show some of this activity.


3.) If one wanted to do this you would essentially have to write a script and add it to launchd where on start up after the partition that /private/var/folders is located on is mounted and then add a script that then does a `rm -rf /private/var/folders/folder-you-want-to-remove` and moves on before any service or application is started.


4.) The file in 2 responses back is related to files that most likely did not complete or are temporary safari files.


I hope this clears things out on this topic, if you know what you are clearing out and you are ok w/ it go for it. I would advise not to completely delete /private/var/folders but delete specific temporary directories that you understand. I personally do clear out my com.apple.appstore directories because of issues I have encountered w/ this Application. I also like to make sure that there are no leftover temporary files from Chrome. This doesn't mean that Apple or other companies will adhere to that all these directories are really used for temporary or in-memory read-write functions.


I also strongly disagree w/ the people who mentioned your disk dying and things such as this, there are utilities that will show if your hard drive is dying, it will show up in logs if you have corruption or errors on the drive. Doing some simple things like monitoring the disk w/ iostat would show the performance.


This is a topic of concern for people that do use SSD disks and/or have small system disks, the release of El Capitan and future releases that use SIP (no real ultimate root control) and features like the abstraction layer between the filesystem and what you actually see is making it become increasingly difficult to debug and manage things like this. Most of us who have been Mac users for years and who are UNIX people who loved NeXT, Darwin, and BSD are being pushed out for the users who do not adequately understand the OS.


So again ** know what you are deleting & understand the ramifications before deleting ** and use care and rtfm. Essentially you need to know what you are doing and if you are not comfortable running commands in the above examples, then you shouldn't be messing w/ your system and application directories.


Best of Luck,

-luke

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.