Safaricleanup is a command line utility for clearing Safari’s browsing history, cache and cookies.
## Installation
- Download the zip file.
- Extract it and copy
safaricleanupinto yourPATH(e.g./usr/local/bin).
## How I use it: automatically clear (some) cookies when quitting Safari
### 1. Create an Automator workflow
Open Automator and select “Service” from the menu.
### 2. Configure the service
At the top of the new document, set the options to “no input” and “Safari.app”.
### 3. Add the “Quit Application” action
Drag the “Quit Application” action into the document and choose “Safari.app” from the drop-down menu in the action.
### 4. Add the “Run Shell Script” action
Drag a “Run Shell Script” action, and paste in the following:
/usr/local/bin/safaricleanup -s -c -t -k --only=facebook.com,twitter.com
See safaricleanup -h for the full list of options.
Hit Save and name the service something like “Clear Data and Quit Safari”.
### 5. Remap the “Quit Safari” menu item
- Go to System Preferences > Keyboard > Shortcuts.
- Choose “App Shortcuts” in the sidebar.
- Click the “+” button.
- Set it to “Safari.app” and enter “Quit Safari” (it’s case sensitive) as the Menu Title.
### 6. Map Cmd-Q to the newly created service
- In the Keyboard Shortcuts preference pane, choose “Services” in the sidebar.
- Find the newly created service and then double-click to the right of it.
- Set the shortcut and press return. Make sure it’s checked.





