Apple - Safari clear cache on quit

The menubar app Cookie can clear exactly what you want to clear at quit, at timed intervals, or both.

Can also clear thosenefarious Tracking Cookies, as well as non-favorite cookies, Flash and other databases -- and do this for all your browsers.

Not part of the company--just think especially with Tracking, it's a must have. SweetPea Productions, trial available.

You could assign a shortcut to a script like this:

osascript -e 'quit app "Safari"'
rm -rf ~/Library/Caches/
rm -rf ~/Library/Caches/Metadata/Safari/History
rm -rf ~/Library/Safari/Databases
rm -f ~/Library/Safari/Form\ Values
rm -f ~/Library/Safari/Downloads.plist
rm -f ~/Library/Safari/History.plist
rm -f ~/Library/Safari/HistoryIndex.plist
rm -f ~/Library/Safari/LastSession.plist
rm -rf ~/Library/Safari/LocalStorage
rm -rf ~/Library/Safari/TopSites.plist
rm -rf ~/Library/Safari/WebpageIcons.db
rm -rf ~/Library/Saved\ Application\ State/

It doesn't remove:

  • Preferences stored in ~/Library/Preferences/
  • Bookmarks
  • Information stored in keychains
  • Extensions or their settings
  • Notification warnings (~/Library/Safari/UserNotificationPermissions.plist)
  • Location warnings (~/Library/Safari/LocationPermissions.plist)

I used dtrace to check which files were opened or deleted when I used the Reset Safari dialog.

sudo opensnoop -n Safari
sudo dtrace -n 'syscall::unlink:entry{printf("%u %s %s",pid,execname,copyinstr(arg0));}'