Some apps (e.g. Tweetbot) have single-key keyboard shortcuts.

However, when trying to set shortcuts in System Preferences, we’re not allowed to do the same. Is there a user-facing way of achieving this?


It is possible to do, both natively and easily. Mac OS X hints has a hint (also check Lri’s comment) on how to set up keyboard shortcuts from the command line. We can use this to create single-key shortcuts.

You’ll need to know the application’s bundle ID (unless you want to set global shortcuts, naturally). For special keys, @ is ; ~ is ; $ is ; ^ is ctrl. You can also check other values.

I’ll use Tweetbot as an example, setting “New Tweet” to +N, and “Reply” (on the multi-shortcut example) to R.

For one-shortcut commands, you can use the form:

defaults write com.tapbots.TweetbotMac NSUserKeyEquivalents -dict-add "New Tweet" -string "~n"

For multi-shortcut commands, use the form:

defaults write com.tapbots.TweetbotMac NSUserKeyEquivalents '{
  "New Tweet"="~n";

For system-wide shortcuts, use -g, instead of a bundle ID.

  • After setting the defaults via the Terminal, if I make any keyboard shortcut changes via System Preferences, it seems to delete my custom defaults entry. :( – nicjohnson Oct 28 '16 at 16:37

I doubt that you can have a system wide single key shortcut to do something like a cut and paste for instance, if that's what you're asking. Doing so would cause the actions to be triggered when you're typing an email, for example.

Some apps allow that most probably because they're programmed so that the single key shortcuts are only detected in certain modes/interfaces. But I could be wrong about Tweetbot because I've never used it :)

  • I doubt it too, and I certainly understand the implications; I’m in no way suggesting a system-wide shortcut. OS X lets you set shortcuts on a per-app basis. Detecting whether said app is in “input text mode” or not could very likely be detected. – user137369 Jun 9 '14 at 21:59
  • Gotcha. I guess it would be useful in your situation if OSX detected if an keypress event is being handled by the app before the user defined keyboard shortcut takes control. But nope...don't see a way in doing that. – user81261 Jun 10 '14 at 5:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .