Disable Command-Q for quitting applications

May 05, '03 08:53:00AM

Contributed by: tinb

Ever hit Command-Q instead of Command-W and lost all of your open web pages in Safari? It happens to me exactly one time to often. So I remembered an old trick to map Command-Q out of the way. Just go to Terminal and enter:

defaults write NSGlobalDomain NSUserKeyEquivalents
   '{"Quit Safari" = "@Q"; "Quit Mail" = "@Q";}'
[That should be one long line with a space after the NSUserKeyEquivalents word]

From now on, Command-Q will "beep" and only Command-Shift-Q will quit the application. A very similar hint tells you how to handle keys like Command-Option-.

You may also use Safari's defaults to change this, but I prefer this "global" way to have these special keys all together in one place. Unfortunately the menu is NOT named simply "Quit" but "Quit Safari," e.g., so you have to enter one extra entry for all apps in question.

Comments (21)

Mac OS X Hints