Reader Question: How to Reset Safari Settings Without Opening Safari

Today's Tech Talk post comes from a reader who asked how one could completely reset Safari's settings without actually opening Safari. The reason: a younger computer user in the family accidentally stumbled onto a website that caused Safari to redirect to other tasteless websites every time the app was opened. In other words, when they opened Safari, so many pop-ups opened automatically that it rendered Safari useless.

In order to resolve the issue, the best course of action would be to completely reset Safari settings (set it back to default settings). This will ensure that whatever redirects were put in place would be removed. Under normal circumstances, you would do this by opening Safari, going to Safari > Preferences... Since we can't even open Safari in this case, we needed to take a slightly different course of action.

The first thing we need to do is restart the computer. This will help to clear out memory and processes. Next, we will open the Terminal application (Finder > Applications > Utilities). Next, we will copy and paste the following text into the Terminal window, then press <enter>:

mv ~/Library/Safari ~/Desktop/Safari-`date +%Y%m%d%H%M%S`; \
rm -Rf ~/Library/Caches/Apple\ -\ Safari\ -\ Safari\ Extensions\ Gallery; \
rm -Rf ~/Library/Caches/Metadata/Safari; \
rm -Rf ~/Library/Caches/com.apple.Safari; \
rm -Rf ~/Library/Caches/com.apple.WebKit.PluginProcess; \
rm -Rf ~/Library/Cookies/Cookies.binarycookies; \
rm -Rf ~/Library/Preferences/Apple\ -\ Safari\ -\ Safari\ Extensions\ Gallery; \
rm -Rf ~/Library/Preferences/com.apple.Safari.LSSharedFileList.plist; \
rm -Rf ~/Library/Preferences/com.apple.Safari.RSS.plist; \
rm -Rf ~/Library/Preferences/com.apple.Safari.plist; \
rm -Rf ~/Library/Preferences/com.apple.WebFoundation.plist; \
rm -Rf ~/Library/Preferences/com.apple.WebKit.PluginHost.plist; \
rm -Rf ~/Library/Preferences/com.apple.WebKit.PluginProcess.plist; \
rm -Rf ~/Library/PubSub/Database; \
rm -Rf ~/Library/Saved\ Application\ State/com.apple.Safari.savedState

Note: it's VERY important that you copy and paste the text exactly as shown. DO NOT attempt to make any modifications, as doing so could cause irreversible damage to other system files.

Once you press <enter>, it will take anywhere from 10 - 60 seconds to run, depending on your system. When it's done, you will see a blank prompt in the Terminal window.

You will notice a new folder on your Desktop named "Safari-[today's date]". This folder will contain a copy of your existing bookmarks and other Safari settings, in case you need to refer to them later. Once it has backed up your settings to your Desktop, this command will then erase all the Safari-related setting/preference files that are fragmented throughout your system, giving you a clean Safari experience once again.

Posted on March 11, 2015 and filed under How To, Mac.