One of the first anomalies I came across in my life of Mac was that you could never quit the Finder. Everything else (mostly) responded to Command-Q, but the Finder was backstopped.
But I digress.
One of the apps that I almost never quit is Safari. If I quit, it’s usually because something went wrong and I need a fresh start. But that rarely ever happens. Safari has gotten better and better over the years at isolating problems, meaning I can usually solve any issues by closing a problematic tab.
Like Caps-lock, the Safari Command-Q is ripe for replacement. John Gruber:
I don’t accidentally quit Safari often, but it does happen. And it’s mildly annoying every time. The last time it happened, I resolved to fix it myself. That’s where my AppleScript comes in.
AppleScript is free, this is worth a look, especially if you’ve never used AppleScript before.
As John footnotes, there is another, simpler solution:
If the only thing you want to do is disable ⌘Q in Safari (or any other shortcut, in any other app, for that matter), the easiest thing to do is use the Keyboards panel in System Prefs (then go to Shortcuts: App Shortcuts) to either set Safari’s shortcut for File → Quit to nothing at all, or to something you won’t hit accidentally, like, say, Control-Option-Shift-Command-Q. Almost no work at all, no third-party software required.
I like the experiment. If you do take it on, be sure to read Gruber’s article in full.