The other day, a customer drove over an hour to visit me in Waitsfield and to show me that her computer was being a jerk: Mail, TextEdit, Preview, and some other native applications were crashing before com.apple.windowserver could even load. She had just upgraded to Mavericks and restored data from an older Time Machine backup.
I repaired permissions in Disk Utility, cleared cache files, and then started canning .plist files in her user library. I usually like to go a step further and get rid of everything in ~/library/“Saved Application State” as well as everything in the “Containers” folder.
The problem persisted. It seemed likely the OS would need to be reinstalled, but my pride wasn’t gonna have that. After many frustrating minutes passed, I began to investigate the issue and discovered this solution online: launch Terminal, execute ‘cd /var/folders’ then ‘sudo rm -rf ./*’ enter an administrator (or root) password, reboot, and voila — problem solved!
We can’t repeat enough: back up your information before attempting a procedure like this in Terminal, simple though it may be. Whenever a “sudo” (short for “super user do,” and no, I’m not clever enough to have made that up) command is invoked, you’re playing with fire, especially if you’ve got a typing deficiency. This particular execution clears all user-generated caches in /private/var which is, itself, an upper-level directory purposely hidden from users in the GUI. Apple thought doing this would lessen the chances of a naïve user unwittingly rendering their launch daemons — or worse, the file system itself — a vegetable. In Unix-speak, “var” stands for “variable,” so this directory contains dynamic files like .db (databases) and .log (logs) file extensions.
You can safely execute the command on a healthy system and see what’s lurking in this, one of the most important of your hidden directories, by changing the flag ‘-rf’ to ‘-rfv.’ Here, “v” makes the process run verbose. Of course, if you or someone you love is experiencing the aforementioned computer ailment and none of this works, you can either stop using computers or bring it into the closest Small Dog retail store for service.