3

I am trying to manually delete the cookies for Safari on Mac OSX Yosemite 10.10.3.

I have done this with Chrome and FireFox before (you simply locate their cookie files and delete them). But I seem to fail when trying to do it with Safari.

My understanding is that Safari's cookie files are in

/Users/me/Library/Cookies

There are at least four files there:

HSTS.plist
com.apple.appstore.cookies
com.apple.ibooks.cookies
Cookies.binarycookies

I have closed Safari and emptied the folder. However, it doesn't seem to have worked because when I visit a website that uses cookies for user authentication, I am still logged in (which does not happen when I do it with Chrome or FireFox).

1

I don't understand the full interplay, but rebooting will fix cookie retention [presumably held in cache] - that is separate from login details remembered by Keychain & also Form Values etc.

If you really want a clean sweep, try OnyX (free/donationware) > Cleaning > Internet - choose what you need to delete from there…

enter image description here

Safari has its own simpler version, though I'm not certain quite what it does delete…

enter image description here

  • Do you know which file is the one that contains the actual Safari cookie data? Cookies.binarycookies or HSTS.plist? – Omega Jul 31 '15 at 15:01
  • Not offhand - delete cookies in OnyX & see which one disappears... – Tetsujin Jul 31 '15 at 16:19
1

Not sure if I fully understand your question, but if you are looking for a way to remove all cookies from Safari via the terminal, without having them regenerated the next time you launch Safari: try the shell script posted below. (I copied this answer from my original post here: https://apple.stackexchange.com/a/273442/201104.)

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 
  • 1
    Please edit your answer to include all relevant info and not just a link to a different answer. The Help Center, in How to Answer, requires answers to be self-contained and not just be a link. – fsb Feb 17 '17 at 17:46

You must log in to answer this question.

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