Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to disable command+Q for quitting apps?

I tried adding this menuitem to the "Keyboard Shortcuts" preference pane (as suggested here), and remapping it to command+option+Q (slightly harder to hit), and the menu item changed to show this, but command+Q still causes the app to quit.

I'm using OS X 10.7, but I'd happily upgrade to 10.8 if it fixed this.

The app I really want this for is Firefox, but if there was a solution that disabled command+Q for every app, that would be fine, too.

share|improve this question
Are you looking for a global hack or would you be able to just remap the applications you want to override? The latter is quite easy using the normal keyboard preference pane and making another shortcut (like command - shift - control - option - Q) that won't get pressed on a whim. – bmike Jan 15 '13 at 21:02
bmike: I'd take either, but as I said, I tried making it command-option-Q and it doesn't work. If I try entering command-option-shift-Q, it beeps and says the app System Prefs has cancelled logout. – Ken Jan 15 '13 at 23:45
The problem is you need to over ride quit on a per application basis and include the app name so that the full menu name is entered in the app-specific shortcut. – bmike Jan 16 '13 at 0:02
bmike: I was specifying the override for Firefox only, and including the app name in the menuitem override. – Ken Jan 16 '13 at 19:58
Hmm - I didn't read the question to mean that Firefox intentionally disregards keyboard shortcut defined by OS X - but perhaps that's what you are seeing based on the comments? I wonder if perhaps they implemented a shortcut remapping function? It's been a while since I've had the fox running. Choosing a command like ⌃⇧⌘Z works to make Command-Q insensitive for Mail and Safari - see this picture for how I set the shortcuts up. – bmike Jan 16 '13 at 20:00

Not a direct answer to your question, but you can tell Firefox to automatically open your old windows when you launch it using the When Firefox starts option under the General preferences pane.

If you don't want to change your start screen just for the occasional accidental quit, there is also a command to do it: History menu -> Restore Previous Session.

share|improve this answer
Yes, but if there are many windows/tabs open, that can take quite a while, and some won't be able to recover their session/state completely. It also annoyingly restores all windows onto the current space, rather than the space they were on previously. – Ken Jan 16 '13 at 20:01

Use a keyboard remapper. There's a great GPL one for OSX (I use Keyremap4MacBook) Just map the command Q key combo to something that does nothing.

share|improve this answer

Using KeyRemap4MacBook, you could add this to private.xml:

  <autogen>__KeyToKey__ KeyCode::Q, VK_COMMAND | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
  <autogen>__KeyToKey__ KeyCode::Q, VK_COMMAND | VK_SHIFT | ModifierFlag::NONE, KeyCode::Q, ModifierFlag::COMMAND_L</autogen>

Without | ModifierFlag::NONE the first autogen element would also disable for example ⌥⌘Q. The second autogen element changes ⇧⌘Q to ⌘Q.

There are also predefined settings that make sending ⌘Q require holding ⌘Q or pressing ⌘Q twice:

They are defined in custom_shortcuts.xml:

  <name>Hold Command+Q to Quit Application</name>
  <appendix>(You can adjust the threshold time of holding by</appendix>
  <appendix>"[Holding Key to Key] Holding Threshold" in Key Repeat tab.)</appendix>
  <autogen>__HoldingKeyToKey__ KeyCode::Q, VK_COMMAND | ModifierFlag::NONE, KeyCode::VK_NONE, KeyCode::Q, VK_COMMAND, Option::NOREPEAT</autogen>
  <name>Press Command+Q twice to Quit Application</name>
  <autogen>__DoublePressModifier__ KeyCode::Q, VK_COMMAND | ModifierFlag::NONE,
    KeyCode::Q, VK_COMMAND
share|improve this answer

Now there is an item in the Chrome application menu "Warn Before Quitting" which does the trick for me.


share|improve this answer

Sorry for digging up such old post but this idea may be useful.

In System Preferences - Keyboard create a new shortcut for the application you want to prevent quit. Search for the title of the quit command in the application's menu and enter the same exact as a Menu Title for the shortcut, then give a different shortcut.

Indeed, you don't have this issue with all applications but only browser and maybe one or two other apps.

share|improve this answer
Welcome to Ask Different! While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – grgarside Jan 10 '14 at 15:27
This solution doesn't apply to firefox. Firefox shows the new shortcut in its menu. But it doesn't work. cmd-q still closes the browser... – JerryWho Jan 28 '14 at 12:43
I followed this link that describes the same solution and that worked perfectly for me. – totymedli Jan 12 '15 at 0:57

Go to System Preferences, then Keyboard. Select Shortcuts. On the left pane, find Accessibility. Now on the right pane enable Invert colors and then click on the shortcut box to reassign the shortcut to Cmd+Q.

That's it. Now when you press Cmd+Q the colors of the screen will be inverted. Press it again to go back to normal colors. No more accidentally quitting applications (like closing over two hundred tabs on Firefox when trying to use Cmd+a or three dozen pdfs on Preview when trying to use Cmd+tab; last two things I did, never again.)

P.S. Whoever thought it was a good idea to use Cmd+Q to quit applications should go back to usability school.

There's also a nice plugin that you can use called Always Ask, which forces a prompt dialog before leaving Firefox.

share|improve this answer

As you have seen, just setting a new keyboard shortcut in the System Prefs doesn't always work. It will change the shortcut shown in the menu but the application could still be listening for the Commmand+Q keypress. I've seen a few apps that do this. Even some will listen to keypresses that are not listed as shortcuts in the menu (Photoshop for example).

A 3rd party option is to use something like ControllerMate. It has the ability to remap any controller input (keyboard, mouse, trackpad, joystick, etc) and change what it does. I use it to do many remaps and run macro scripts. They can be set on a per-application basis or a global system-wide state.

Using ControllerMate, you could map Command+Q to do nothing then have Command+Option+Q call the Quit menu entry. Or you could get fancy and have Command+Q do nothing except if you press Command+Q again within 1/2 of a second then it would call the Quit menu.

ControllerMate is an amazing app. I've done many customizations like a "Boss/Spouse Mode" which is a single keypress that does the following

  • mutes the computer audio
  • pauses iTunes if it is playing
  • quits QuickTime and/or VLC if it is running
  • minimizes current Firefox windows and opens a new window to

Another suggestion (along with Henry's suggestion) is to use a session manager so if Firefox is quit by accident, you can restore easily. The built-in session manager is OK but you should also look at Tab Mix Plus. Not only does it give you amazing options for managing your tabs but its session manager is also great. I have many sessions saved and can pull them up quickly anytime in new windows.

share|improve this answer
$24.95 for an input remapper? That's hilarious. – Navin Jan 20 at 1:53

Go to System Preferences>Keyboard>Shortcuts then the application button on the left bar. Press the + button then Choose your application. Write "Quit (Application Name)" in the Menu Title Slot. Add your command to replace cmd-q and that's it.

share|improve this answer
This adds nothing that the other answers haven't already covered. – Tetsujin Jan 14 at 17:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.