Quite simply, I'd just like to modify the right command key to escape and that's it. Keep the left command key as is.

The only tool I've been able to find for this is ControllerMate but I'd rather not pay $14 to map one key.

Can anyone suggest a free alternative?

  • I thought the left and right command keys are the same key codes and therefore indistinguishable.
    – Alexander
    Jul 4 '13 at 14:26

You can download Ukelele. It is an free keyboard layout editor, and you can make a new layout for your keyboard where simple redefine the keys. In the package are sample keyboards and a manual/tutorial too.

  • 1
    I have no idea how to use this application. Each time I press the right command key, the left one lights up on it's keyboard mapper. And also, browsing the comments the author mentions that you can't differentiate between the different command keys (in ukelele).
    – Matt
    Jun 12 '11 at 11:09
  • So, my answer was not helpful. I know no other way, sry.
    – jm666
    Jun 12 '11 at 11:38
  • @Matt I know it's been over half a decade, but on my Powerbook G4 and my Apple Extended Keyboard, both the command keys are wired to the same "key id." Unlike every other key on the board, there is absolutely no way to differentiate between one command key and the other via software.
    – Wyatt Ward
    Jun 9 '18 at 15:40

Ukelele or keylayout files can't be used to change modifier keys to other keys. But you could use a private.xml like this with KeyRemap4MacBook:

<?xml version="1.0"?>
    <autogen>__KeyToKey__ KeyCode::COMMAND_R, KeyCode::ESCAPE</autogen>

This would only change pressing the right command to escape:

__KeyOverlaidModifier__ KeyCode::COMMAND_R, KeyCode::COMMAND_R, KeyCode::ESCAPE

<only>VI, TERMINAL</only> would apply the settings only when MacVim, Terminal, or iTerm is frontmost.

See the source for the key code values and predefined settings.

You must log in to answer this question.

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