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

Answer from Matthew on Stack Exchange
Top answer
1 of 2
1

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

2 of 2
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

🌐
Apple Community
discussions.apple.com › thread › 8658504
Remove Cookies on Exit from Safari? - Apple Community
December 3, 2018 - You are welcome. All cookies downloaded when using a Private Window are deleted when the window is closed. Data is cleared. Go to Safari/Preferences/General and set Safari open with to A new Private window.
Discussions

How to auto-delete safari cookies on exit… - Apple Community
What could I do to auto delete safari cookies on exit without surfing problems? ... Now I had some time to care about this topic and I solved it (Nobody said it will be easy.) Safari does not provide any option to auto-delete cookies on quit like other browsers do. So the idea is do delete the cookies on shut down of Max OS X using a shell script: *1. Create an empty Cookie file* a) Open Safari b) Go to Preferences –> Security - > Show Cookies c) Delete all ... More on discussions.apple.com
🌐 discussions.apple.com
Clear cookies after 'quit safari' - Apple Community
Remove Cookies on Exit from Safari? Cookies are one of the most intrusive and dangerous sources of malware on the 'net, along with some desirable qualities. I have always set up my browsers to accept cookies from sites I visit, and to delete all cookies on exit from the browser as both a security ... More on discussions.apple.com
🌐 discussions.apple.com
July 26, 2018
Safari Extension to automatically delete cookies | MacRumors Forums
Utopia would be an extension for Safari for both macOS and iOS that would delete all of my cookies every (say) 8 hours except for the few that I mark as special (such as Duck Duck Go's cookie... I think all the rest I have no desire to keep). Some browser delete all the cookies upon quitting... More on forums.macrumors.com
🌐 forums.macrumors.com
March 24, 2022
Delete the cookies of certain websites in Safari
Yes. Settings / Safari / Advanced (at the bottom). Tap "Website Data". Search for the cookies etc. you want to delete (e.g., google). Swipe left on any of the items and then tap "delete", or tap "edit" bottom-right and tap the red minus icon. More on reddit.com
🌐 r/ios
6
7
February 24, 2024
🌐
Stack Overflow
stackoverflow.com › questions › 63977502 › how-to-auto-delete-cookies-in-safari
macos - How to auto-delete cookies in Safari? - Stack Overflow
/etc/rc.common #StartService () #{ #} StopService () { cp -f /Users/XXXXX/Library/Cookies/CleanedCookies.plist /Users/XXXXX/Library/Cookies/Cookies.plist } RestartService () { StopService } RunService "$1" {quote} f) Change „XXXXX“ to your username (at two places!) g) Press „Ctrl - X“ (it asks if it should save the document) h) Press „Y“ (it asks for a file name) i) Type „DeleteCookies“ j) Don’t close the Terminal! We will need it again. ... {quote} { Description = "DeleteCookies"; Provides = ("Deletes Safari cookies on shut down"); Uses = ("Disks"); } {quote}
🌐
Medium
medium.com › @brettjohnson2088 › how-to-delete-cookies-automatically-at-browser-exit-e909513de6c9
How to Delete Cookies Automatically at Browser Exit? | by Brett Johnson | Medium
March 13, 2018 - If you do not want to spend money on a cookie-clearing app, you can also manually delete cookies each time you exit Safari. To do so, go to the Preferences option from the Safari menu, choose Details under the Privacy tab and hit Remove All.
🌐
Apple Support
support.apple.com › guide › safari › manage-cookies-sfri11471 › mac
Clear your cache and cookies in Safari on Mac - Apple Support
You can see all the websites that have stored cookies and website data on your Mac, and you can remove some or all of it. ... Go to the Safari app on your Mac. Choose Safari > Settings, then click Privacy.
🌐
Gizmodo
gizmodo.com › clear-cookies-close-browser-chrome-edge-safari-firefox-1850218542
How To Clear Cookies Every Time You Close Your Browser
March 13, 2023 - You’ll either need to block them in the first place or erase them manually, as we’ve described above. You can also do your Safari browsing in private windows, which means cookies aren’t permanently stored.
🌐
Apple Community
discussions.apple.com › thread › 1737931
How to auto-delete safari cookies on exit… - Apple Community
What could I do to auto delete safari cookies on exit without surfing problems? ... Now I had some time to care about this topic and I solved it (Nobody said it will be easy.) Safari does not provide any option to auto-delete cookies on quit like other browsers do.
Find elsewhere
🌐
HCTC
hazard.kctcs.edu › faculty-staff › technology_solutions › clearing_browser.aspx
Clear Browser Information
... Start your browser. Tap Menu, and then tap More. Select Settings. Under "Privacy settings", select Clear cache, Clear history, or Clear all cookie data as appropriate, and then tap OK to accept (or Cancel to cancel) the deletion.
🌐
MacRumors
macrumors.com › how-to › delete-cookies-safari
How to Delete Cookies in Safari - MacRumors
Note that you can opt to block all cookies in future by selecting Block all cookies in Safari's settings (Settings -> Safari on iOS, and in the Privacy tab of Safari's Preferences on macOS).
🌐
Apple Community
discussions.apple.com › thread › 8474669
Clear cookies after 'quit safari' - Apple Community
July 26, 2018 - Safari is not written to automatically clear cookies, history, and caches on exit. If one chooses Safari : Clear History… : all history, and click the Clear History button, then history and cookies will be removed (as observed in Safari 11.1.2).
🌐
HelloTech
hellotech.com › home › how to clear cookies in chrome, safari, edge, and firefox
How To Clear Cookies in Chrome, Safari, Edge, and Firefox : HelloTech How
November 7, 2023 - Then select a Time range. If you select All time, it will clear all your cookies from Edge. Finally, click Clear now. You can also set Edge to automatically clear cookies whenever you exit the browser.
🌐
Wikihow
wikihow.com › computers and electronics › internet › internet browsers › safari browser › how to delete cookies and cache on safari: mac & ios
How to Delete Cookies and Cache on Safari: Mac & iOS
February 19, 2026 - ... Clear your cookies and cache only (save history). If you want to remove your cookies and cache but save your history, do the following: Open Settings. Tap Apps and select Safari.
🌐
MacRumors
forums.macrumors.com › software › mac apps
Safari Extension to automatically delete cookies | MacRumors Forums
March 24, 2022 - The basic function of cookies is to save your preferences for a site, like dark theme on this one. When you delete the cookies, the site asks you again what’s your preference, that is saved in a cookie. You can use a normal Safari window for your “special” sites and a Private Window for the website data you want gone when you close the window.
🌐
Apple Support
support.apple.com › en-us › 105082
Delete your Safari history, cache, and cookies on iPhone - Apple Support
Tap Select Websites, then select one or more websites to delete from your history. Tap the Trash button. If you want to block cookies (data a site places on your device to remember you), go to Settings, tap Apps, choose Safari, then tap Advanced. Turn on Block All Cookies.
🌐
The Mac Observer
macobserver.com › home › how to clear cookies in safari on iphone, ipad: tips and tricks
How to Clear Cookies in Safari on iPhone, iPad: Tips and Tricks
August 29, 2025 - Go to Settings › Safari › Clear History and Website Data to remove all cookies. Use Advanced › Website Data to delete cookies for specific sites.
🌐
Reddit
reddit.com › r/ios › how to auto delete cookies on exit?
r/ios on Reddit: How to auto delete cookies on exit?
April 15, 2023 -

Is there a way to auto delete cookies on exit, but also to whitelist specific sites? I can’t find it anywhere in Safari settings and I’ve tried pretty much every decent browser there is too but can’t find such option. Even if I can’t whitelist, I just basically want private mode but with browsing history enabled.

🌐
Apple
help.apple.com › safari › mac › 8.0 › en.lproj › sfri11471.html
Manage cookies and website data using Safari
Remove stored cookies and data: Click Remove All Website Data, or click Details, select one or more websites, then click Remove. Removing the data may reduce tracking, but may also log you out of websites or change website behavior. See which websites store cookies or data: Click Details.
🌐
Reddit
reddit.com › r/macos › automatically delete safari cookies
r/MacOS on Reddit: Automatically delete Safari cookies
June 8, 2024 -

Hey all, is there a way to set things up so that Safari automatically clears all the browser cookies on a set schedule (e.g., once weekly)? I regularly clear them myself, but it's annoying and I forget regularly.

🌐
Quora
quora.com › How-do-I-delete-cookies-using-the-Safari-web-browser
How to delete cookies using the Safari web browser - Quora
· · If you are using Safari on Mac, you can use the built-in functionality to clear the cookies and cache. Open the Safari browser. Click on Safari in the menu bar and open Preferences ...