Delete Chrome's history before quitting [SOLVED]

Is it possible to run a macro right before Chrome quits when I hit CMD+Q?
I would like to delete my browsing history when I close the browser.
I tried an extension, but it's a bit buggy, not always deleting it. That was the only one that seemed to be working and still being developed, but not very reliable.

I guess one of the alternatives is to create a macro that's trigged by CMD+Q, add the actions to that macro and the last action is to quit Chrome.
I was wondering if there's another way without changing the shortcut/trigger.

Is there an AppleScript or shell script that does this? Right now I'm opening the History tab and performing a few actions visually speaking. I was wondering if it can be done behind the scenes with some code to make it faster and less "visually intrusive"?

According to this thread: macos - Clear out Chrome history from command line? - Ask Different, the files that save the History are present here:
~/Library/Application Support/Google/Chrome/Default/
and they are:

  • History
  • History-journal


I noticed that the "History-journal" is the only one that is completely empty when I clear the history from within Chrome. I also noticed, by moving those files to the Desktop, that Chrome creates them once I start Chrome again. Maybe I can set up a macro that deletes those files when I quit Chrome?

Any idea if this is a good way of doing it? Any issues with this approach? Any other way of clearing the history if not this one?

You could make it ⌥⌘Q.

Or there's this.

Alternatively, if you always want to delete the history upon quit, I'm pretty sure Chrome has a preference for that.

1 Like

I wish, but it doesn't. That was my first thought. That's why there's extensions for that. It's weird that Google doesn't have that option. And here's what's even weirder:
If you are on a website and you decide to quit Chrome without closing that website's window/tab, that website goes to a tab called Recently Closed, and even if you delete the History, that stays there. There's also no preference to enable/disable that. So there's a "privacy" issue there that they should definitely address.
There's a "hack" which is supposed to work and it's exiting it twice, but that doesn't work for me.

That was exactly my point haha I want to still use ⌘+Q

Yeah I saw another one like that, but way simpler. I'm not sure why the long script... I just used rm pathToFile and it worked.


Thanks for sharing that, thought.
So I guess my question has been answered: deleting those files is not a dangerous thing to do.

1 Like