Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

safari cookies: where are they located?

I was looking into finding out where Safari was keeping its Cookie and Cache data it reports. After a lot of looking around, I am still in the dark.


Even when I quit Safari and run (using srm to totally wipe it so it cannot be found via some extra other hard link):


srm -rf Library/Preferences/Macromedia

srm -rf Library/Safari

srm -rf Library/Caches/*

srm -rf Library/Cookies/*

find . -name \*afari\* -exec srm -rf {} \;


the last one removes


./Library/Preferences/com.apple.Safari.plist

./Library/Saved Application State/com.apple.Safari.savedState

./Library/SyncedPreferences/com.apple.Safari.plist


and I relaunch Safari (6.0.5 on Mountain Lion), the cookies are still there. I am completely in the dark. Where are the Cookies and Cache data?

Posted on Jul 27, 2013 6:01 AM

Reply
9 replies

Apr 6, 2017 9:54 PM in response to Gerben Wierda

Hi Gerben! I too had the same problem. On my MacBook Pro there was a cookie from “weather.com” that would NOT go away. I searched through every folder named Library, as well as the contents folder of Safari. Nada. I tried the “remove and remove all” commands that are built into Safari over and over with the same results: nada! I was about to give up when I DuckDuckGoed and came to your discussion page. I read down the replies and nothing was suggested that I had not already tried in vain. Then I came to Scotch Brawth’s suggestion that I “Install CCleaner from the App Store.“ I could not find CCleaner in the App Store but it was on the web. I cleaned cookies and a bunch of other stuff, but, the cookie “who shall not be named” was still there. Then, out of the blue, I remembered ONYX from Titanium Software (https://www.titanium-software.fr/en/index.html). I downloaded the correct version for my OSX software and ran the cookie cleaning sections. To my utter delight, when I opened Safari and checked for “weather.com,” it was GONE! I know for a fact that Onyx will work! So go get a copy and sleep easier tonight.

Nov 19, 2017 6:31 AM in response to NWProf

For macOS Sierra 10.12.6 and Safari 11.0.1, most likely, the cookies and references to websites that survive clicking -- the "Remove" and "Remove All" buttons in the Safari->Preferences->Privacy->Manage Website Data pane -- reside in each user's or account's library.


In the Utilities/Terminal.app, type

rm -frP ~/Library/Safari/Databases/* ~/Library/Safari/LocalStorage/*


That command line will terminate with extreme prejudice the files where those persistent annoyances reside.


Unix shell command line to English translation:

  1. rm is the name of the Unix command that deletes files from the filesystem.
  2. f in -frP forces rm to work quietly without complaints or asking for permission before doing anything.
  3. r in -frP instructs rm to traverse or walk the filesystem sub-tree beneath each of the pathnames that follow.
  4. P in -frP tells rm to overwrite each file or directory with junk before unlinking either a file or directory from its parent directory.
  5. The ~ (tilde) before each pathname is an abbreviation for $HOME or "my home directory."
  6. The / (slash) separates directory names in pathnames; do not replace it with any other character.
  7. The * (asterisc) after each pathname is an abbreviation for "everything that resides beyond."


Running that command line from inside an AppleScript when Safari is shut down would be ideal, but if that isn't possible, running that command from a cron file once a day would be acceptable.

Jul 27, 2013 6:32 AM in response to Gerben Wierda

You are directing all of those commands to the main ("All users") library. You need to delete the stuff in your user Library. Its path is /Users/shortUserName/Library. Or, ~/Library should work.


Why don't you just turn on Private Browsing?

If you search for it, you will find a few things on flushing the cache. I'm not sure if those are valid any longer.

Jul 27, 2013 7:09 AM in response to Barney-15E

No, I was talking about the user's Library (~/Library) and not the general Library (full path /Library). I just did not explicitly mentioned ~/ because for me that is default (if you start from your home directory, Library and ~/Library are the same).


What I did find out that the whole cookie process is now managed via a daemon (cookied) which apparaently keeps its own data somewhere in the general systems area.


I wonder how 'private' 'Private Browsing' really is, and I suspect the cookies are stored anyway, they are just outside of reach of the Safari processes that may need/use them. And then there are the plugins that may or may not respect the 'private browsing' settings. Suppose you are under a dictatorship and you want to remove traces you have visited some opposition site, I would not trust 'Private Browsing' against good forensic snooping and I would only trust the removal of data if it is also wiped (not just unlinked)). Hence, I would always want to know where the data is really stored so I can wipe it instead of unlinking it.


I tried from a Guest user and noticed that just starting Safari which opened a standard Apple page added a cookie for fbcdn.net (Facebook) and apple.com. At some point I had a cookie for macrumors.com which did not go away, not even when I completely reset Safari, not even when Safari had no windows open and Private Browing was turned on. I suspect there is some complex interplay between 'saved application states', the system-wide cookie daemon cookied and its data, and more, all leading to a system that is not really private and where data cannot be removed.


I was not removing the data while Safari was running. I would quit Safari first and then remove it.

Jul 28, 2013 11:50 AM in response to Gerben Wierda

Install CCleaner from the App Store. It allows you to manage cookies and caches for all installed web browsers, as well as other useful things. It's free. One of the best things is the cookie management, which allows you to whitelist certain cookies so that, when running the Delete Cookies function, the ones you whitelisted are left alone. Very useful for not deleting login cookies for your favourite sites.


If you're really concerned about browsing privately, install and use the TorBrowserBundle. This will leave no browsing traces whatsoever once closed. Make sure to read some of the information on that website so that you understand the benefits and limits of using that software.

Jul 28, 2013 1:32 PM in response to Gerben Wierda

Its odd that Safari is continuing to show the cookies, but they are stored in the following directories:


~/Library/Safari/LocalStorage/

~/Library/WebKit/LocalStorage/


..so removing the contents of this will clear them and the database that interfaces with them.


There is also a media cache in $TMPDIR/com.appleWebKit.WebContent+com.apple.Safari, which may also be represented in the Safari preference (not sure though).

safari cookies: where are they located?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.