Skip to content

Instantly share code, notes, and snippets.

@pkutzner
Created February 13, 2014 20:14
Show Gist options
  • Save pkutzner/8982939 to your computer and use it in GitHub Desktop.
Save pkutzner/8982939 to your computer and use it in GitHub Desktop.
Script to clear out Safari caches
#!/bin/bash
set -o nounset
pgrep Safari >/dev/null 2>&1 && { echo "Safari is still running, exiting..." | logger -t "privacy.sh"; exit 1; } || { echo "Removing Safari history/caches..." | logger -t "privacy.sh"; }
library="/Users/USER/Library"
safari_root="${library}/Safari"
sleep 5
rm -rf ${safari_root}/{{Downloads,History,TopSites,LastSession}.plist,HistoryIndex.sk,WebpageIcons.db} ${library}/{Cookies,Caches/com.apple.Safari}/*
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment