Add Compose key to OS X
I wrote a complete article explaining how to set up a real compose key (ie. Right Option + ' + e → é for instance), using a combination of KeyRemap4MacBook and specific Cocoa input rules.

Step 1: choose a Compose key

Choose the Compose key so that it is easily accessible but does not prevent you from doing anything you ordinarily do. I use the Right Option key as my Compose key. I already have a Left Option key so the right one is a bit useless to me. And it somehow matches the position of the Compose key on old Sun keyboards.

That would be Right Option on a Mac keyboard. I recommend that.

Step 2: remap the Compose key

The problem is that the Mac OS X keyboard preferences:


do not let you differentiate between Left Option and Right Option keys
only let you remap modifier keys to another modifier key (or to nothing)


Fortunately, there is KeyRemap4MacBook that lets you do very low level things with your keyboard. Install it.

We will now remap our compose key to something that the next layer will understand. I chose Shift Control F13 for that. It is very unlikely you will need that key combination.

In the file ~/Library/Application Support/KeyRemap4MacBook/private.xml put the following:

&lt;?xml version="1.0"?&gt;
&lt;root&gt;
  &lt;item&gt;
    &lt;name&gt;Send Shift-Ctrl-F13 for Right Option&lt;/name&gt;
    &lt;identifier&gt;private.send_shift_ctrl_f13_for_ropt&lt;/identifier&gt;
    &lt;autogen&gt;--KeyToKey-- KeyCode::OPTION_R,
                          KeyCode::F13, ModifierFlag::SHIFT_L
                                      | ModifierFlag::CONTROL_L
    &lt;/autogen&gt;
  &lt;/item&gt;
&lt;/root&gt;


Finally, from the System Preferences, open the KeyRemap4MacBook settings and click on the ReloadXML button. Then activate the new option.

Step 3: create compose bindings

The last step is the creation of the actual bindings. I chose to import the rules from /usr/share/X11/locale/en_US.UTF-8/Compose on my Debian system.

Bob Kåres wrote a script that lets you convert X11 compose rules into Cocoa key bindings.

Either convert a Compose file of your own using Bob’s script, or download my DefaultKeyBinding.dict from the article. Save it in ~/Library/KeyBindings/DefaultKeyBinding.dict.

Be careful: by default Bob’s script uses F13 instead of Shift Ctrl F13 so in DefaultKeyBinding.dict you need to change:

"\UF710"


into:

"^$\UF710"


If for some reason you decided to go for another combination, check out this article by Xah Lee to find out the proper syntax.