The new Safari 4 beta has been released and it boasts many new features, including what is now being called a security nightmare for the browser. The data trail within the browser reveals hidden files of a user’s history and XML files that can, quite literally, add up to gigabytes of personal information left on the computer. Much of this information is kept in obscure locations, making it difficult for the average user to find and clean out.
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 100Mb.
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 93Mb.
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 a huge problem considering how fast the folder grew in such a short amount of time. It is also a problem for the myriad users that don’t know these files even exist. The privacy nightmare emerges when one realizes just how much information is being kept and that most of it needs to be removed manually.
There are some tips you can follow that may help you with the new beta at Mac OS X Tips. Remember, this is still in beta, so if you are using it, you are presumably wanting to help fix problems such as these. Private browsing will also eliminate these worries, but you have to know about it first in order to actually use it.

