MacOS – Change the shortcut of cmd+Q for all applications

macos

I use cmd+tab, cmd+W, cmd+A a lot and I don't remember how many times I hit cmd+Q accidentally.

Is it possible to change the shortcut for quitting applications from cmd+Q to something else (not to disallow using keyboard to quit applications), ideally for applications all at once (not to do it for individual application one by one)?

Best Answer

This should change the shortcut to ⇧⌘Q for most currently installed applications:

defaults write -g NSUserKeyEquivalents -dict-add $(mdfind kMDItemContentType==com.apple.application-bundle | grep -v { | sed 's/.*\//Quit /g;s/\.app$//g;'"s/'/\\''\\'/g;s/^/'/g;s/$/' '\$@q'/g" | uniq | tr '\n' ' ')

You could also use KeyRemap4MacBook to change ⌘Q to some other key combination or require holding or pressing it twice to quit an application.