Reset Safari on Mac without opening (using Terminal)

Safari is arguably the safest and fastest of browsers. Its Apple’s own application and comes preloaded on its devices. Yet not all users are equally excited about it. The reason? It needs to be configured frequently.  One of the safest ways to reconfigure this is to reset Safari from the Terminal using the Command Prompt.

Why does Safari need resetting?

Over time, Safari fails to holdback pop-ups. Unmonitored dialog boxes that refuse to close may make your system vulnerable to malware or expose underage users to restricted sites. Or, while you sit down for work or leisure, you may be redirected to irrelevant pages repeatedly. In both cases, the browser stops working.  

How do you reset Safari from the Command Prompt?

You can safely do this by following the steps listed below. These do not need users to be particularly tech-savvy. So let’s get started.

Resetting Safari

#1. Open the Terminal application, like so:

Finder > Applications > Utilities

#2. The next step requires users to copy a series of commands and paste it onto the Terminal window

The codes must be identical to the ones given below. Any modification is likely to damage the system beyond repair.

The codes are as follows:

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/; \
rm -Rf ~/Library/Caches/; \
rm -Rf ~/Library/Cookies/Cookies.binarycookies; \
rm -Rf ~/Library/Preferences/Apple\ -\ Safari\ -\ Safari\ Extensions\ Gallery; \
rm -Rf ~/Library/Preferences/; \
rm -Rf ~/Library/Preferences/; \
rm -Rf ~/Library/Preferences/; \
rm -Rf ~/Library/Preferences/; \
rm -Rf ~/Library/Preferences/; \
rm -Rf ~/Library/Preferences/; \
rm -Rf ~/Library/PubSub/Database; \
rm -Rf ~/Library/Saved\ Application\ State/

After you’ve pasted it, hit Enter to complete changing the setting. To use Safari once more, restart your system and launch the browser.

These commands are all you need to erase the old browser settings and get a new Safari browser that can block pop-ups, dialog boxes, and redirects. What you achieve through this is essentially a factory reset. Safari goes back to its earliest default setting before you began to customize it.

Alternative solution

Another way to bypass these issues is to migrate to a secure browser or use a different browser for specific activities online. There are some great browsers out there, for instance, Kingpin that hides all your browsing behavior. With it set to confidential browsing by default, you can go around several web risks like phishing or loss of passwords. 

Kingpin does not save cookies or the data you enter online. Once your browsing session is over, the browser is wiped clean. You can block ads and recommendations too. It always works on the Incognito mode which is especially useful when one is making online transactions or browsing sensitive content. An additional browser is a safer option today.

Three things to keep in mind before resetting Safari

  1. Check for updates on the Mac OS and install if they have been released: Safari must run on the latest version of Mac OS to utilize its full set of features 
  2. Close all running applications: It ensures your data loss is minimal during the Safari reset process and other applications are not affected. 
  3. Create a backup file for all your bookmarks: You must have a list of bookmarks that takes you swiftly to useful sites. By deleting all stored data, you risk erasing all bookmarks too. Here is how you can find your bookmark file.

Apple icon > Go to Folder > type ˜/Library > open folder Safari > find file Bookmarks.plist

This file records all your saved bookmarks. Better create a backup document of them before you go all blitzkrieg on browsing data.

Common solutions like disabling wireless network and deleting browser history along with stored data are usually enough to run Safari smoothly on Mac. But the fixes mentioned above fall short in your case since Safari can’t even be launched without the various dialog boxes and windows opening automatically. Even force quitting the browser does not help at all. Some users suggest holding the Shift key down while launching Safari but the effect is not consistent across all systems and versions. 

In this case, you need to take a different approach – resetting Safari from the Terminal using the Command Prompt. A step-by-step solution has already been provided above. Follow the code sequence and your browser should be up and running just like before. 

All in all, Safari is prone to malfunctioning from time to time like many other browsers. However, its fixes are easy to apply. If you would rather avoid tampering with system setting you can always continue online activities with an additional browser like Kingpin.