Obviously, in Linux I can use xmodmap. On Leopard, I used an InputManager called PCKeyboardHack. But InputManagers are now broken.

How can I preserve my sanity and keep on using Caps Lock to Escape in OS X 10.6?

7 Answers 7


I may be way off as I'm nowhere near my Mac to check, but would Ukelele be able to remap the Caps lock? I know you can remap the Caps lock using system preferences too, but I think the possible replacements are limited (again away from a Mac to test)...

You could also see if doublecommand has that mapping included, as reports suggest it works in 32bit kernel mode in SL at least...


There seems to be a PCKeyboardHack fork for SL:


  • Thanks! The new build of PCKeyboardHack has solved it. My fingers and my sanity thank you in advance!
    – Tom Morris
    Sep 2, 2009 at 20:18
  • 1
    Glad to help; you should mark this question as answered ;-) Sep 3, 2009 at 11:24
  • PCKeyboard hack totally the way to go. Jan 29, 2011 at 22:32

It's not really an answer to your question, but I imagine you want to remap the key so your finger hasn't so far to travel to switch Vim modes. A week or two ago I discovered that Ctrl-[ is the same as hitting Esc, and easier to type even though it's two keys.

I'd suggest teaching your fingers to do Ctrl-[ instead, then you don't need to remap any keys and you don't lose Caps-lock functionality.

  • This is the recommended way to use Vi(m) even if you can use the escape key. As well as giving you device independence, it's more "touch typing friendly". Sep 24, 2017 at 16:15
  1. Open System Preferences
  2. Open the Keyboard Preferences
  3. Make sure you're on the 'Keyboard' tab
  4. Click 'Modifier Keys'
  5. Change them to whatever you like.
  • 4
    While this is nice, it can only remap between Caps Lock, Control, Option and Command. Notice the lack of Escape, Delete, Return, and Shift. PS Does it annoy anyone else that menus and dialogs use symbols for caps lock, control, shift, option and escape that simply don't actually appear on the keyboard?
    – dlamblin
    Sep 24, 2009 at 21:07
  • This works now (escape is listed there, at least on my MacBook Pro with touch bar High Sierra) Jun 25, 2018 at 17:42

had two issues when compiling.

1: Make sure you have the developer stuff in your path. specfically, add the following line to your path:


2: some bizarre error with otool not being found: the error I got looked like this "*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'launch path not accessible' "

use this to resolve it:

ln -s /Developer/usr/bin/otool /usr/bin/otool

after that, everything worked for me.


Though this does not answer your question it might be the solution to your problem:

" Mapping ESC in insert mode and command mode to double i
imap ii <C-[>
cmap ii <C-[>

Put this into your .vimrc file. After that you can press ii to get out of insert or command mode. You do not need to reach out to your ESC or CAPS lock key.


I use Seil to remap my Mac keyboard https://pqrs.org/osx/karabiner/seil.html.en

  1. Download Seil
  2. Check 'Change the caps lock key'
  3. Change keycode from 51 to 53

Note, you must also nullify the default Caps Lock key from your Mac Keyboard settings.

  1. Settings->Keyboard->Keyboard tab
  2. Click on Modifier Keys (bottom right)
  3. Change Caps Lock setting from 'Caps Lock' to 'No Action'

It may be obvious, but with recent macOS version, we can natively do this in the keyboard settings (sorry screenshot in French):

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.