Skip to content
FLAVIO COPES
flaviocopes.com
2026

Safari, warn before quitting

By Flavio Copes

Learn how to stop accidentally quitting Safari with cmd-Q by remapping its keyboard shortcut to cmd-option-Q from the macOS Keyboard settings.

~~~

I’m a browser hopper.

I use a browser for too many hours a day and sometimes I just have to change browser, just to try something new.

Today it was the turn of Safari.

I like Safari, a lot. It’s light, no-frills, and very fast.

However, while opening a new tab with cmd-W I accidentally pressed cmd-Q, quitting the browser.

Chrome and Firefox provide a nice, optional confirmation dialog when trying to close them:

Browser confirmation dialog asking "Quit and close tabs?" with Cancel and Close Tabs buttons

Safari does not have it.

So I re-mapped the cmd-Q to cmd-option-Q.

Here’s how I did it: open System Preferences, and click Keyboard:

macOS System Preferences window showing various preference panes including General, Desktop, Dock, and Keyboard

Click Shortcuts, then App Shortcuts:

Keyboard preferences with Shortcuts tab selected showing App Shortcuts category in left sidebar

Add a new shortcut, choose Safari and call the Menu Title “Quit Safari”, and add the new shortcut:

Add shortcut dialog for Safari showing Application dropdown, Menu Title field, and Keyboard Shortcut field

There it is:

Keyboard shortcuts panel showing Safari section with Quit Safari command mapped to cmd-option-Q shortcut

Since this has the same title of the existing Quit Safari menu, the shortcut will now change:

Safari application menu showing Quit and Keep Windows command with cmd-option-Q keyboard shortcut

No more accidental quitting.

~~~

Related posts about platform: