2

For the longest time the ill-named "Safari Cookies" extension (by using SIMBL) provided this function of automatically deleting all cookies in Safari when quitting the application.

But development of that project has stopped and it does not work with the latest version of macOS and Safari. Instead they sell a 20USD product that promises to continue doing that and more.

Is there any free option for providing what should be an essential privacy feature of any modern browser? I don't want to select "Clear history..." from the Safari menu every time I use that application.

1
  • you could turn on the option to block all cookies. then just clear them once.
    – Natsfan
    Commented Oct 24, 2017 at 15:56

2 Answers 2

1

You can use the private mode which erases cookies(I think) and your history upon closing the windows.

1
  • Different functionality though, that doesn't keep cookies within the session or between windows.
    – JMY1000
    Commented Oct 24, 2017 at 17:18
0

Safari does not provide an option to auto-delete cookies on quit as other browsers do. So the idea is, to delete the cookies on shut down of Mac OS X using a shell script:

1. Create an empty Cookie file

  • Open Safari
  • Go to Preferences –> Security - > Show Cookies
  • Delete all Cookies
  • Quit Safari without loading any website in between
  • Open Finder
  • Go to „/Users/XXXXXX/Library/Cookies/“ (Replace XXXXX with your username)
  • Copy „Cookies.plist“ to „CleanedCookies.plist“ in this folder*

Done! Now you should see two files in the folder „~/Library/Cookies/“: „Cookies.plist“ and „CleanedCookies.plist“!

2. Create autostart shell script

  • Open Terminal

  • Type: „cd /Library/StartupItems/“

  • Type: „sudo mkdir /DeleteCookies“ - > Enter your password

  • Type: „sudo pico“ (a shell text editor will open)

  • Paste this inside:*

    #!/bin/sh 
    
    . /etc/rc.common 
    
    #StartService () 
    #{ 
    #} 
    
    StopService () 
    { 
    cp -f /Users/XXXXX/Library/Cookies/CleanedCookies.plist /Users/XXXXX/Library/Cookies/Cookies.plist 
    } 
    
    RestartService () 
    { 
    StopService 
    } 
    
    RunService "$1" 
    
    
  • Change „XXXXX“ to your username (at two places!)

  • Press „Ctrl - X“ (it asks if it should save the document)

  • Press „Y“ (it asks for a file name)

  • Type „DeleteCookies“

  • Don’t close the Terminal! We will need it again.*

3. Create StartupParameters

  • In Terminal type: „sudo pico“

  • Paste this inside (with { and }):*

    {quote} { Description = "DeleteCookies"; Provides = ("Deletes Safari cookies on shut down"); Uses = ("Disks"); } {quote}

  • Press „Ctrl - X“ (it asks if it should save the document)

  • Press „Y“ (it asks for a file name)

  • Type „StartupParameters.plist“

  • Now you may close the Terminal*

Now you should see two files in the folder „/Library/StartupItems/DeleteCookies/“: „DeleteCookies“ and „StartupParameters.plist“. Done!

4. Restart the system

  • Restart your computer
  • After reboot it will tell you that StartupItems do not have the right permissions
  • Click on „Correct Permissions“ (2 times for the two created files)
  • Restart your computer again.*

Now your Safari-Cookies should be deleted automatically each time when you shut down your PC.

Text source: apple community

1
  • Aside from the fact that this does not answer the question asked "Is there a way to automatically delete all cookies in Safari upon exit?" it also is no longer accurate of even applicable in regards to Safari today muchness three years ago when the question was original asked! Posting something from 12 years ago as an answer to this question is quite ridiculous! The individuals that upvoted this are clueless! Commented Sep 21, 2020 at 13:19

You must log in to answer this question.

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