Remap CapsLock(tap) to ESC and CapsLock(hold) to CTRL in OS X Lion
Step by step instructions:
- Install both PCKeyboardHack and KeyRemap4MacBook. It will prompt you to reboot after installing the apps.
- Disable Caps Lock. Go to System Preferences -> Keyboard -> Modifier Keys. Set Caps Lock to "No Action".
- In PCKeyboardHack set Cap Lock to Control_L by changing the Caps Lock keycode to 59.
- In KeyRemap4MacBook, toggle "Control_L to Control_L (+ when you type Control_L only, send Escape". I searched for "Control_L escape" and it showed up near the top.
UPDATE:
On High Sierra, this functionality is built into the new Karabiner Elements.
Follow the install instructions, then:
- Open Karabiner-Elements
- Click "Complex Modifications"
- Click "Add Rule"
- Click "Import more rules from the internet"
- On the resultant web page, look for "Modifier Keys > Change caps_lock Key" and import the configuration.
- Profit!
This worked for me on OSX 10.9:
- Set Caps Lock to Control. Go to System Preferences -> Keyboard -> Modifier Keys. Set Caps Lock to "^ Control",
- Install KeyRemap4MacBook,
- In KeyRemap4MacBook, toggle "Control_L to Control_L (+ when you type Control_L only, send Escape".