I tried deleting Cookies in Safari manually, by deleting ~Library/Cookies, ~/Library/Caches/com.apple.Safari and ~/Library/Safari.

The folders gets deleted, but the next time I launch Safari all cookies are restored. I am logged in all websites.

What did just happen? Why can't I delete cookies?

  • I added a comment under my answer, not sure if you got notified of it.
    – owlswipe
    Commented May 25, 2016 at 11:06
  • Which of the answers solved it for you?
    – ilam engl
    Commented May 27, 2022 at 13:54

2 Answers 2


Yes, there is a way to effectively remove all cookies from Safari via the terminal as well, preventing the auto-restore phenomenon you described. I wrote a simple shell script some time ago to achieve this.

I tested this on macOS 10.12.3 and Safari 10.0.3 and it works.

Warning: The tests I did weren't as thorough, meaning: some of the files deleted by this script might not actually be necessary in order to achieve the removal of the cookies, you should trial-and-error your way around it to narrow it down if you like. I personally use the script 'as is', but in your personal situation that might mean you'll lose some data that you actually wanted to keep.

Copy this into a simple shell script and run it (be sure to also copy the 'killall' command):

rm -rf ~/Library/Safari/History*
rm -rf ~/Library/Safari/Auto*
rm -rf ~/Library/Safari/LocalStorage
rm -rf ~/Library/Safari/Downloads.*
rm -rf ~/Library/Safari/Databases
rm -rf ~/Library/Safari/SearchDescriptions.plist
rm -rf ~/Library/Safari/WebFeedSources.plist
rm -rf ~/Library/Safari/Last*
rm -rf ~/Library/Safari/Recently*
rm -rf ~/Library/WebKit/com.apple.Safari
rm -rf /Library/Cookies
rm -rf ~/Library/Cookies
rm -rf ~/Library/Caches
rm -rf /Library/Caches
rm -rf ~/Library/Application Support/Oracle/Java/Deployment/cache
rm -rf ~/Library/Preferences/Macromedia/*
rm -rf ~/Library/Containers/com.apple.Safari.*
rm -rf ~/Library/Application Support/com.apple.sharedfilelist/*
rm -rf ~/Library/Preferences/com.apple.coreservices.useractivityd.dynamicuseractivites
rm -rf ~/Library/Preferences/*SpotlightNetHelper*
rm -rf ~/.oracle_jre_usage
rm -rf ~/Library/Preferences/com.apple.sharekit.recents.plist
rm -rf ~/Library/Saved*

killall -KILL nsurlstoraged 
  • I used only the lines above related specifically to Safari, not even the killall, and it unfroze my Safari's "Manage Website Data".
    – 2540625
    Commented Apr 4, 2018 at 16:50

To delete all your cookies/stored website data in Safari:

  1. Open Safari
  2. On the menubar at the top of your screen, hit "Safari", then click "Preferences"
  3. Go to the Privacy tab of the preferences menu
  4. Click "Remove all website data".

This should remove all the cookies that websites have stored on your Mac.

  • 2
    yes, that is the UI way of doing it I am wondering, why can't I just delete the files manually?
    – sanjihan
    Commented May 25, 2016 at 10:19
  • @sanjihan you may well have successfully deleted your cookies, but you did not delete your website data cache (I don't think) and you did not turn off Safari's auto fill of your saved passwords. Learn more about how to do all of that here: macworld.co.uk/how-to/mac-software/…
    – owlswipe
    Commented May 25, 2016 at 11:05
  • @owlswipe I think the reason for OPs deleting manually, is that what you describe does NOT work. At least for me that's the case... Seems to be a common problem see: discussions.apple.com/thread/7942811 So you actually have to delete manually via the terminal - or finder...
    – ilam engl
    Commented May 27, 2022 at 13:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .