2

How can I reset Safari 8 cookies from the command line?

I've read the question Reset Safari from command line which seems to work fine for Safari 7, but this method no longer seems to work with Safari 8 (on Mac OS X Yosemite).

It appears that the ~/Library/Caches/com.apple.Safari/ is the location where Safari stores the files, but if I quit safari, delete that directory, and then restart Safari, the files that were there just come back. Safari must be storing the data elsewhere, too - but I can not find this location.

I have tried also doing killall cookied and killall -9 cookied and also killing SafariNotificationAgent but this seems to have no effect.

I have attempted to watch what files are being accessed by Safari using sudo fs_usage Safari but this does not give me much help, either.

I have also researched "alternatives" that would yield the same result without luck:

  • A way to start Safari in Private Browsing mode ( only found a hacky applescript way to do it )
  • A way to clear all cookies on exit - maybe an extension? ( no luck with this, either )

The method from the link above to work fine on Safari 7.

How can the same thing be done with Safari 8?

0

The article Deleting Safari cookies via AppleScript suggests this script for deleting the cookies of three specific websites :

set deCookie to {"nytimes.com", "go.com", "cnn.com"}
tell application "System Events"
  tell process "Safari"
    keystroke "," using command down
    delay 1
    tell window 1
      click button "Privacy" of tool bar 1
      delay 3
      repeat with d in deCookie
        click button "Details…" of group 1 of group 1
        try
          keystroke d
          delay 1
          select row 1 of table 1 of scroll area 1 of sheet 1
          click button "Remove" of sheet 1
        end try
        click button "Done" of sheet 1
      end repeat
    end tell
    keystroke "w" using command down
  end tell
end tell

Written in 2013, this script might need to be adapted to Safari 8.

0

It's been awhile since I've used OS X but in the past you could get at the cookies via deleting the files within the app itself. Have you poked around in Safari.app directory? Find the local storage in there and delete the directory you were removing before, and start Safari.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.