Monday, February 26, 2024

Remapping OS X Application Keyboard Shortcuts

Sometimes you may try to assign a keyboard shortcut to a new command (such as a Service or Application Shortcut), and it won’t work due to that command already being taken. Or perhaps you want to assign a shortcut that utilises the Delete key. That can’t be done in the Keyboard Preferences panel on Mac OS X. All these things can be done by Terminal commands.

The following command will clear the keyboard shortcut you wish to utilise of any other modifications, which may be necessary if you find the key you are applying is not working. This example is for Finder, to clear the shortcut for the command for New Finder Window.

defaults write NSUserKeyEquivalents -dict-add "New Finder Window" nil

To see what keymapping changes have already been made (most likely by you), use this command:

defaults read NSUserKeyEquivalents

Replace “Finder” with the name of the Apple application you are messing around with. Such as Safari, iPhoto, Pages, etc. If you haven’t made any, Terminal should come back with:

The domain/default pair of (/Users/jonathan/Library/Preferences/, NSUserKeyEquivalents) does not exist

Or if you have made changes, such as I have on Mail, you’ll see something like this:

defaults read NSUserKeyEquivalents<br />{<br /> "New Message" = "@m";<br /> "New Note" = "@n";<br />}

To make CMD-m the key for new messages in Apple Mail type this into Terminal:

defaults write NSUserKeyEquivalents -dict-add "New Message" "@m"

The next question is, what character to type into Terminal in reference to the keyboard key (SHIFT, COMMAND, CONTROL, etc.) you wish to bind to the shortcut. The following table shows which Character to use for each.

Character         Special Key                Abbreviation

@                      Command (Apple)       CMD

~                       Option                          OPT

$                       Shift                              SHIFT

^                       Control                          CTRL

So COMMAND-SHIFT-A will be @$a

Recent Articles


Related Stories


    • Hi Zev. It’s so long ago I post this tip I am not sure if they are documented by Apple or not. I suspect they might be, somewhere. But I couldn’t say where.

Leave A Reply

Please enter your comment!
Please enter your name here

Stay on op - Ge the daily news in your inbox