How to programmatically delete cookies in Safari 8.0 on OS X 10.10 (Yosemite)

In Safari 8.0 (10600.1.25.1) on OS X 10.10.1 (Yosemite), I visit some sites, such as google.com, apple.com, facebook.com, and then see cookies when I click "Safari" β†’ "Settings. .. "β†’" Confidentiality "β†’" Read more ... "

Then I complete Safari completely (actually completing, not just closing the window) and delete the following things using the following.

rm -r ~/Library/Caches/com.apple.Safari/ rm -r ~/Library/Cookies rm -r ~/Library/Safari

When I restart Safari, the cookies still exist, and I still register on the website that stores the cookie after logging in.

What cookies do I need to delete or what do I need to do to make Safari actually delete cookies?

I need to be able to move / rename files / directories and then move them later. Cocoa cookies can delete cookies ( http://ditchnet.org/cocoacookies/ ), and when I use fswatch there are no interesting files that change.

+5
source share
2 answers

I think Apple Script is the way to go; see the related blog post here . Below I copied the Google Script example.

  1 set deCookie to {"nytimes.com", "go.com", "cnn.com"} 2 3 tell application "System Events" 4 tell process "Safari" 5 keystroke "," using command down 6 delay 1 7 tell window 1 8 click button "Privacy" of tool bar 1 9 delay 3 10 repeat with d in deCookie 11 click button "Details…" of group 1 of group 1 12 try 13 keystroke d 14 delay 1 15 select row 1 of table 1 of scroll area 1 of sheet 1 16 click button "Remove" of sheet 1 17 end try 18 click button "Done" of sheet 1 19 end repeat 20 end tell 21 keystroke "w" using command down 22 end tell 23 end tell 
+3
source

I know a little late, but I made RemoveCookie , a command line utility that removes Safari cookies. Quite simply, it uses the NSHTTPCookieStorage API , which can be useful for anyone who wants to manage Safari files.

+1
source

Source: https://habr.com/ru/post/1208170/


All Articles