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.

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

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:

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

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