Skip to content

Safari, warn before quitting

How to avoid closing Safari by mistake, using a simple trick

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:

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:

Click Shortcuts, then App Shortcuts:

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

There it is:

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

No more accidental quitting.


→ I wrote 17 books to help you become a better developer:

  • C Handbook
  • Command Line Handbook
  • CSS Handbook
  • Express Handbook
  • Git Cheat Sheet
  • Go Handbook
  • HTML Handbook
  • JS Handbook
  • Laravel Handbook
  • Next.js Handbook
  • Node.js Handbook
  • PHP Handbook
  • Python Handbook
  • React Handbook
  • SQL Handbook
  • Svelte Handbook
  • Swift Handbook
...download them all now!

Also, JOIN MY CODING BOOTCAMP, an amazing cohort course that will be a huge step up in your coding career - covering React, Next.js - next edition February 2025

Bootcamp 2025

Join the waiting list