Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Reset Safari 10 for current user. Developed and tested under OS X 10.11.6 El Capitan.
- # Backup bookmarks to Desktop, exiting if unsuccessful
- cp -v ~/Library/Safari/Bookmarks.plist ~/Desktop/Bookmarks-`date +%Y%m%d%H%M%S`.plist
- if [[ $? -ne 0 ]]; then exit 1; fi
- # Delete main Safari data directory
- rm -rfv ~/Library/Safari
- # Delete caches
- rm -rfv ~/Library/Caches/com.apple.Safari
- rm -rfv ~/Library/Caches/com.apple.Safari.SearchHelper
- rm -rfv ~/Library/Caches/com.apple.safaridavclient
- rm -rfv ~/Library/Caches/com.apple.WebKit.PluginProcess
- rm -rfv ~/Library/Caches/Metadata/Safari
- rm -rfv ~/Library/Caches/SafariNotificationAgent
- rm -rfv ~/Library/Caches/com.apple.commerce.safari/SafariLibrary
- # Delete cookies
- rm -rfv ~/Library/Cookies/Cookies.binarycookies
- rm -rfv ~/Library/Cookies/com.apple.safari.cookies
- rm -rfv ~/Library/Cookies/com.apple.CaptiveNetworkAssistant.binarycookies
- rm -rfv ~/Library/Cookies/com.apple.Safari.SafeBrowsing.binarycookies
- rm -rfv ~/Library/Cookies/com.apple.Safari.SearchHelper.binarycookies
- # Delete preferences
- rm -rfv ~/Library/Preferences/com.apple.Safari.LSSharedFileList.plist
- rm -rfv ~/Library/Preferences/com.apple.Safari.RSS.plist
- rm -rfv ~/Library/Preferences/com.apple.Safari.plist
- rm -rfv ~/Library/Preferences/com.apple.Safari.Extensions.plist
- rm -rfv ~/Library/Preferences/com.apple.WebFoundation.plist
- rm -rfv ~/Library/Preferences/com.apple.WebKit.PluginHost.plist
- rm -rfv ~/Library/Preferences/com.apple.WebKit.PluginProcess.plist
- rm -rfv ~/Library/Preferences/com.apple.commerce.safari.plist
- # Delete saved state
- rm -rfv ~/Library/Saved\ Application\ State/com.apple.Safari.savedState
- # Delete RSS feeds subscribed in Safari or Mail
- # More info on PubSub database and command:
- # http://krypted.com/mac-os-x/managing-mail-and-safari-rss-subscriptions-from-the-command-line/
- rm -rfv ~/Library/PubSub/Database
- # Delete yet more Safari data (cannot find any definitive documentation on this directory)
- rm -rfv ~/Library/WebKit/com.apple.Safari
- # Delete SharedFileList
- rm -rfv ~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.apple.safari.sfl
- # Delete LSOs / Flash cookies
- rm -rfv ~/Library/Caches/Adobe/Flash\ Player
- # Clear file quarantine database (i.e., list of downloaded files)
- # More info: http://osxdaily.com/2012/07/12/list-download-history-mac-os-x/
- sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'
- # Delete QuickTime cache
- rm -rfv ~/Library/Caches/QuickTime
- printf "\n\n\033[1;32mSafari cleanup complete.\n\n\033[1;31mThe contens of /Library/Internet Plug-Ins and ~/Library/Internet Plug-Ins\nwill appear below after pressing Enter. Check output for unwated plugins.\nPreserve Quartz Composer.webplugin & Default Browser.plugin at a minimum.\033[0m\n\n"
- read -p "Press Enter to continue."
- # List contents of /Library/Internet Plug-Ins and ~/Library/Internet Plug-Ins
- ls -A /Library/Internet\ Plug-Ins ~/Library/Internet\ Plug-Ins
- #############
- # START NOTES
- #############
- ## Reference:
- ## <https://tinyapps.org/blog/mac/201702110700_reset_safari_10.html>
- ###########
- # END NOTES
- ###########
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement