Disabling Command+Q for macOS Terminal

Josh Sherman
1 min read
Productivity Apple

I don’t just use the command-line, I live on it.

With doing some much on the CLI, I always have the Terminal app running, regardless of my host operating system.

Sadly, on macOS, I do find myself accidentally hitting Command+Q from time to time, which abruptly bails me out of the Terminal.

While I am usually running a tmux session (or a few), this isn’t the biggest inconvenience in the world, but I do find it frustrating enough that I sought out to figure out how to ax that shortcut entirely.

Before I proceed with talking about how to disable the shortcut, keep in mind that I do have “Ask before closing” set to something other than “Always”.

Obviously having that turned on would keep me from accidentally closing windows, but it also would mean that I’d be prompted even when I’m closing tabs, which I do regularly, and would get pretty old quick.

That all being said, there is a quick and easy way to remove the shortcut (or change it to something else, if that’s your thing). From the terminal, simply run:

defaults write com.apple.Terminal NSUserKeyEquivalents -dict-add "Quit Terminal" nil

And boom, Command+Q will cease to work within the Terminal app.

Regretting the decision? You can undo it running this (note @ means Command):

defaults write com.apple.Terminal NSUserKeyEquivalents -dict-add "Quit Terminal" "@Q"
Join the Conversation

Good stuff? Want more?

Weekly emails about technology, development, and sometimes sauerkraut.

100% Fresh, Grade A Content, Never Spam.

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.

Currently Reading

Parasie Eve

Previous Reads

Buy Me a Coffee Become a Sponsor

Related Articles