Update: As of MacOS Sierra 10.12.1,
the remapping of Caps Lock to Escape can be done natively in the Keyboard System Preferences pane.
Follow the steps below to remap Caps Lock to Escape (without relying on 3rd party software).
Open System Preferences and click on
KeyboardClick on
Modifier Keys...For
Caps Lock Key, chooseEscapeClick
OK
The Old Way of Using Seil¶
Seil
(previouly known as PCKeyboardHack) is great tool for mapping keys on Mac.
Let me illustrate how to use Seil.
As a heavy Vim user,
I find it is necessary to swap the Caps Lock key with the Escape key.
Change the behavior of Map Caps Lock Key to No Action on Mac.
Open
System PreferencesOpen
KeyboardOpen
Modifier Keys...Change
Caps Lock KeytoNo Action
Map the behavior of Caps Lock key to the Escape key using
Seil.Click on
Change the caps lock keyinSeilCheck
Change the caps lock keyFill 53 (keycode of Escape) in the keycode text box
Map the behavior of the Escape key to the Caps key using
Seil.Click on
Other keysinSeilCheck
Change Escapefill 57 (keycode of the Caps Lock key) in the keycode text box.