Monthly Archives: May 2009


Safari 4’s Messy Trail

Safari throwing crap around

Those of you who’ve been trying out the new Safari 4 beta – at least on the Mac, though I imagine you could find similar data trails on the Windows version too – have no doubt been impressed at its shiny new features. But if you’re a stickler for disk space like I am, or a stickler for privacy (or, heaven help you, both), Safari’s poor housekeeping is quite alarming.

Let’s start with the easy stuff. In ~/Library/Caches/Metadata/Safari reside two folders: Bookmarks and History. Inside the history folder is a file for every webpage you’ve visited, regardless of when you’ve set Safari to delete history items in your preferences. I suspect Safari does some cleanup here as the files become slightly more sparse as one travels farther back in time (the past week – the time I’ve set Safari to delete history items after – usually comprise about half of the items, and I’m pretty sure my browsing habits aren’t increasing logarithmically), but I cannot figure out what gets kept and what doesn’t. Each item can be anywhere from 4-200k, but those add up when you get thousands of them. Deleting everything past a week old saved me over 100 MB.

This particular dump has been around at least since a version of Safari 3, but Safari 4 is even more egregiously unhygenic. You know the fancy new Top Sites feature, and how it tells you with a little blue star peeled away from the page preview if it’s been updated since you last checked? Safari makes a little file for every site, every time it checks on them, which if RefreshInterval is in seconds as I suspect it is, means it creates a nice XML file for every one of your top sites every 30 minutes (1800 seconds). These are located in ~/Library/PubSub/Feeds/ and given arcane hexadecimal names, and contain whatever turned out to be new on the webpage. As the Wikipedia homepage is one of mine and changes just about constantly, the vast majority of my XMLs were filled with Wikipedia content. I had over 24000, and deleting everything more than a week old (again, about half of the items) saved me about 93 MB.

But even this isn’t the worst of it. The most outrageous thing I found, and it took drinking from Spotlight’s firehose of filesystem changes with FSEventer to find it, was that Safari does not delete the webpage previews it generates for Quicklook. Ever. 2.03 GB of webpage previews (2 per website – a full resolution and a thumbnail), all generated since downloading the Safari 4 beta, residing – not in the user library, not even in the root library – in /private/var/folders/et/etuAKaR1GTeV9DVeRGfst++++TI/-Caches-/com.apple.Safari/Webpage Previews/, a hidden folder far away from the mouseclicks of all but the most relentless tinkerers.

This is completely unacceptable, for two reasons: The first is that there is no reason for Safari not to clean up after itself and let these folders get this big. If it grew to over 2 GB in just a few months, was it just going to grow until I ran out of disk space next year? What of the users who don’t know to delete it? As much as Apple might like to think we have practically infinite disk space for it to throw its crap everywhere, truth is, not all of us can afford terabyte drives to offload our media onto. The average user is going to have no idea where his disk space has gone, and 2 GB is definitely a noticeable amount. I can’t think of a good reason they couldn’t have at least put it in the user library with everything else: hiding it there is nothing short of deceptive.

Secondly, this is a huge privacy concern. With no good way of getting rid of them except manually (clearing the history doesn’t do it) these hidden files are strewn all over the user’s hard drive unbeknownst to him waiting for snooping relatives (or more pertinently, law enforcement) to dig them up.

I really like Safari, but I’m going to have to seriously consider using Firefox now (ack). Or maybe Chrome will arrive with enough polish to take over.

Update: It seems this is indeed a bug and not a feature, possibly confined only to Leopard systems as Tiger users’ histories seem to clear when they’re set to. Hopefully this will be fixed in the final Safari 4. Also fixed miscellaneous typographical errors.