Skip to content

Instantly share code, notes, and snippets.

@tsibley
Last active August 24, 2023 14:01
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save tsibley/152bfa70deaf2a497155 to your computer and use it in GitHub Desktop.
Save tsibley/152bfa70deaf2a497155 to your computer and use it in GitHub Desktop.

How to get a real Compose key on OS X

1. Install the U.S. Custom keyboard layout

Follow the installation and activation instructions for the U.S. Custom keyboard layout.

2. Install Karabiner (formerly KeyRemap4MacBook) or Karabiner Elements

If you’re using macOS Sierra (10.12), install Karabiner Elements.

If you’re using macOS El Capitan (10.11) or lower, install Karabiner.

If you’re on macOS 10.8 or earlier, you'll still use KeyRemap4MacBook, also available at the Karabiner link.

3. Configure the right Command key as your new Compose key

If you installed Karabiner Elements, add a "simple modification" mapping right_command to non_us_backslash.

If you installed Karabainer, edit and reload the private.xml file of Karabiner (formerly KeyRemap4MacBook) to contain the following:

<?xml version="1.0"?>
<root>
    <item>
      <name>Send ISO Section for right Command</name>
      <identifier>private.send_iso_section_for_right_command</identifier>
      <autogen>--KeyToKey-- KeyCode::COMMAND_R, KeyCode::UK_SECTION</autogen>
    </item>
</root>

If you already have a private.xml, you should only paste in the <item> element.

Full instructions are at: https://pqrs.org/osx/karabiner/document.html.en#privatexml

4. Enable the new “Send ISO Section for right Command” option in Karabiner/KeyRemap4MacBook

Ticky the box next to it. If you can't find it, use the search to narrow down the list. If you still can't find it, make sure you completed step 3 correctly.

5. Try it out!

Focus on any text input and try typing the following sequence to make a ♥: Right Command, <, 3

You can discover what compositions are available by using my “compose” program.

@jacel
Copy link

jacel commented Aug 26, 2015

Hi, I use compose key on my windows at work and it's great. Unfortunately using your script the right command key doesn't work as a compose key, it just enters this symbol §. I copied your xml exactly, what's going on? Cheers

@tsibley
Copy link
Author

tsibley commented Sep 29, 2015

@jacel Did you activate and switch to the U.S. Custom keyboard layout from step 1? Instructions here: http://uscustom.sourceforge.net/#installation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment