Remap Your Caps Lock Key for Fun & Profit (Oct. 2016 Update)

Update October 10, 2016:
If you have upgraded to macOS Sierra, this method will no longer work. The creator of Karabiner and Seil is working on a new tool called Karabiner Elements that will support Sierra. According to the GitHub repo, “Karabiner-Elements works fine except Preferences GUI.” As of now, you need to edit settings using a JSON file, which is not ideal. I’ll add another update when this app is ready for primetime.

I thought about making the title of this post “I remapped my caps lock key, you won’t believe what happened next.” But, I didn’t want it to sound too much like clickbait, so I ended up with the title above. The real truth is that I wanted to document these methods here for the next time I need to set up a new machine. If it is helpful for you as well then I’ll consider it a bonus. OK. Let’s get going!

People do lots of different things with their caps lock key. Some hit it by accident when typing and in a fit of rage just turn it off altogether. If you don’t have a good use for your caps lock key and always hit it by mistake, you are in luck. It is pretty simple to disable it.

Disabling your caps lock key:

Disable the caps lock key in OS X
  1. Head over to the system preferences panel and navigate to the keyboard section.

2. In the bottom-right click on the button that says “modifier keys.”

3. The caps lock key is the first option. From the dropdown, select “No Action.”

Voila! No more hitting the caps lock key by mistake.

Remapping your caps lock key to another key on the keyboard:

Other people choose to map the caps lock key to other keys on the keyboard. Some emacs users remap the caps lock key to the control key. The control key is a modifier for many different actions within the application. Many Vim users map their caps lock key to the escape key. The escape key is how you to exit the editor’s insert mode.

Here is an example of mapping your caps lock key to the escape key:

Remapping the caps lock key to the escape key using Seil
  1. Download and install Seil.
  2. Follow the instructions under Disabling your caps lock key.
  3. Open the Seil app and expand the first option “change the caps lock key.”
  4. In the input to the far right, enter the keycode for the escape key (53)
  5. In the bottom-right click “Quit Seil.”

Seil’s approach is very simple. It allows you to replace one key with another by allowing you to enter the the keycode of the key you want to use. The keycodes are listed at the bottom of the window.

Remapping your caps lock key to multiple keys on the keyboard:

To recap, we’ve covered how to disable your caps lock key and how to map it to another key on the keyboard. But, what if you want to map your caps lock key to multiple keys on the keyboard? Yes, you read that right. Two for the price of one. What a deal!

This is the method that I use on my two machines. The command (⌘) key and option key are a pretty powerful when used together. In both Chrome and Firefox you can cycle backward and forward through your open tabs by holding down the command (⌘) and option keys and tapping either the left or right arrow. You can also map iTerm to use the same key combination to cycle through its open tabs too.

Hopefully, this sounds like much more fun than the other options. I taking great liberty in the use of the word fun here. But, if this sounds interesting to you read on!

To map the caps lock key to multiple keys, we will need another piece of software called Karabiner from the same developer. The plan of action is to map the caps lock key to an unused key on the keyboard (F19). Then, using Karabiner, we will map that unused key to another key and modifier key (⌘ + option) using a bit of custom code. Don’t sweat writing the code, I’ll include a snippet for you to cut and paste.

  1. Download and install both Seil and Karabiner
  2. Follow the instructions above to disable your caps lock key.
  3. Open Seil and expand the first option “change the caps lock key.”
  4. In the input to the far right, enter in an unused key. In my example, I used the “F19” key.
  5. Close out of Seil.

The next section covers the additional steps that are necessary in Karabiner.

Open private.xml to add the custom code
  1. Open the Karabiner app.
  2. Click on the “Misc and Uninstall” tab all the way to the top right of the application window.
  3. In order to map our caps lock key to multiple keys, we need to open the “private.xml” file in a text editor and enter in our custom code. Under the custom setting header, tap the “Open Private.xml” button.
  4. This will reveal the file in the finder. Open this file in whatever text editor you feel most comfortable with. Sublime Text or Atom will work fine. You’ll need to paste the code below into the file.

In a nutshell, we are assigning a name, description, and ID to our custom key mapping. Then, in the <autogen> section, we are telling Karabiner that this will be a key to key mapping from the F19 key to the left ⌘ key. Then, we are adding a modifier of the left option key. Karabiner listens for the F19 key, which we have mapped our caps lock key to using Seil and then maps it to ⌘ + option. Check out the Karabiner reference manual for more about the private.xml file.

Save the private.xml file and return to the Karabiner app.

The last step is to click the “reload XML” button to register your changes to the private.xml file. Now, if you head over to chrome and open a few tabs, you should be able to toggle forward and backward using the combination of the caps lock key and the left or right arrow key.

Cycling through tabs in Chrome using the caps lock key + left or right arrow.

I hope this tutorial was interesting and useful. I would love to hear your thoughts! Is there an easier way to do this? Are you using key remapping for something else? Let’s hear it!