MacOS – HD filling up with cached data

disk-spacemacossafarissd

I have a 256GB SSD which usually sits at around 30GB available space, but recently I've had a problem with what appears to be over zealous caching which has on a number of occasions eaten the entire 30GB.

Last time it happened my system was grinding to a halt with no space left at all, its amazing what breaks when there's no disk space, so I just deleted the offending files. This caused issues with my Keychain but I managed to recover.

Yesterday I got the warning again, and I was down below 10GB, I'm now sitting at 18GB without deleting anything since, so it seems to be rapidly up and down.

I've used Disk Inventory X to investigate and the culprit seems to be the folder:

/private/var/folders/l2/khdpc8h92l187pz9yl490fhc0000gn/C/com.apple.WebKit.Plugin.32/fsCachedData

Currently there's 30,110 files in that folder using up 8.8GB, which seems a little excessive on its own! I'm pretty sure thats the same folder that eventually swells to fill up my HD.

As far as I know, WebKit is safari's engine? I use 4 Safari extensions which are: 1Password, AdBlock, BetterTTV and Reddit Enhancement Suite.

Any idea what specifically is causing this? or how I might identify the culprit? I'm also on Sierra 10.12.2 beta.

Best Answer

I had the same problem; wrote the following bash script and run it once daily with cron. Problem solved. When I first noticed this, I had over 50GB in the fsCacheData folder!

#!/bin/bash
DIR=/private/var/folders/6m/36p_j3ss0zjbfjh3r72qjtw40000gn/C/com.apple.WebKit.Plugin.64/fsCachedData/
LIMIT=1                 
SIZE=$(du -h $DIR | cut -f 1)           

if [[ "${SIZE%?}" -ge $LIMIT ]];
    rm -r $DIR
fi