I've always remapped my caps lock key to escape in windows/linux, but having just recently moved to OS X I can't seem to find a way to actually do this. Any idea as to how to set this up? Xmodmap seems to only be respected by x11 applications, and I'd highly prefer this to be system wide.

link|improve this question
feedback

migrated from stackoverflow.com Feb 7 '10 at 12:46

This question came from our site for professional and enthusiast programmers.

5 Answers

There's a Preference Pane called PCKeyboardHack that lets you remap keys based on a keycode. Remap Caps Lock to keycode 53 (the escape key).

Given that PCKeyboardHack works at the driver level, it works system-wide. I installed it and tried it myself, and it did what I think you want (when I press the key labelled 'Caps Lock', the action that would normally be triggered by pressing the Escape key is performed).

link|improve this answer
I use this on one of my machines: on another I use a custom build of DoubleCommand. – Matthew Schinckel Feb 8 '10 at 7:43
feedback

If you aren't afraid to modify the source code, this can be done with DoubleCommand. Probably easier to go with PCKeyboardHack though.

link|improve this answer
feedback

Ukelele an osx keyboard layout editor should be able to do it.

edit: Actually, it can't. Sorry.

link|improve this answer
IIRC, you cannot do this with Ukelele. – Matthew Schinckel Feb 8 '10 at 7:42
Verified, you are right, had an incorrect memory :) – jaska Feb 8 '10 at 11:47
feedback

You cannot easily do it out of the box. What you can do is remap capslock to some other key you don't use, e.g. the Help Key. Then you can use another key remapper software to remap the Help Key to ESC.

See here for details.

link|improve this answer
feedback

This really isn't a question for stackoverflow, more for www.superuser.com.

The keyboard preference pane does allow you to change the default bahaviour, but not to escape, sorry

link|improve this answer
feedback

Your Answer

 
or
required, but never shown