# Safari, warn before quitting

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

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2020-05-05 | Topics: [Web Platform](https://flaviocopes.com/tags/platform/) | Canonical: https://flaviocopes.com/safari-warn-before-quit/

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](https://flaviocopes.com/images/safari-warn-before-quit/Screen_Shot_2020-04-27_at_15.26.41.jpg)

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](https://flaviocopes.com/images/safari-warn-before-quit/Screen_Shot_2020-04-27_at_15.21.23.jpg)

Click Shortcuts, then App Shortcuts:

![Keyboard preferences with Shortcuts tab selected showing App Shortcuts category in left sidebar](https://flaviocopes.com/images/safari-warn-before-quit/Screen_Shot_2020-04-27_at_15.21.26.jpg)

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](https://flaviocopes.com/images/safari-warn-before-quit/Screen_Shot_2020-04-27_at_15.21.38.jpg)

There it is:

![Keyboard shortcuts panel showing Safari section with Quit Safari command mapped to cmd-option-Q shortcut](https://flaviocopes.com/images/safari-warn-before-quit/Screen_Shot_2020-04-27_at_15.24.00.jpg)

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](https://flaviocopes.com/images/safari-warn-before-quit/Screen_Shot_2020-04-27_at_15.24.10.jpg)

No more accidental quitting.
