Setting up a real Compose key on Mac OS X

The Compose key is my method of choice for international character input. It lets me type characters as diverse as é Â ẃ ṗ § … « ¿ ¥ ¹ ½ © × using simple and intuitive key combinations.

How intuitive exactly? Let’s see:

  • Compose + C + , gives me Ç.
  • Compose + l + / gives me ł.
  • Compose + < + < gives me «.
  • Compose + - + > gives me →.
  • Compose + < + 3 gives me ♥.
  • Compose + C + C + C + P gives me ☭ (no kidding).

You can of course set up your own rules. This shit is so powerful that I cannot imagine I could ever use any other input method.

So, one would think that with all its glorious Unix heritage, Mac OS X would let you get the most out of your keyboard like the good old X11 system does. Well it turns out it’s possible, but not straightforward.

Fortunately, other people already did all the work. I will just indicate how to put their stuff together.

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. Fortunately, modern keyboards come with more and more idiotic and useless keys.

I use the Right Alt key as my Compose key. I already have a Left Alt 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 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:

<?xml version="1.0"?>
    <name>Send Shift-Ctrl-F13 for Right Option</name>
    <autogen>__KeyToKey__ KeyCode::OPTION_R,
                          KeyCode::F13, ModifierFlag::SHIFT_L
                                      | ModifierFlag::CONTROL_L

Finally, from the System Preferences, open the KeyRemap4MacBook settings and click on the ReloadXML button:

The new option should appear. Activate it:

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. 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:




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

Step 4: restart all applications

And that’s it! Your Mac OS X system is now slightly more usable.

  • Posted: 2012-06-18 08:18 (Updated: 2015-09-05 19:38)
  • Author: sam
  • Categories: a11y osx tip

Attachments (4)

Download all attachments as: .zip


1. anonymous -- 2012-06-18 17:03

So you finally switched to Mac

2. anonymous -- 2012-06-29 15:29

For some reason I can't use the circumflex sequences (like compose ^ A → Â) with your DefaultKeyBinding.dict. Everything else seems to work nicely. Have you got any idea what might cause this or do you struggle with that problem as well?

3. sam -- 2012-06-29 15:41

@anonymous what comes to mind is the possibility that ^ is a dead key, meaning it behaves differently, though how exactly is yet to be determined. This is the case if you use for instance the US-International keyboard layout instead of the plain US layout: ^ ~ and ` become dead keys.

I should check when back home whether I have the same problem, but I have never been bothered because I use the > A → Â combination instead.

4. anonymous -- 2012-07-02 14:57

Thanks, compose > A → Â works fine. Maybe I'll adjust DefaultKeybinding.dict to remap all circumflex bindings (it's mostly superscript numbers) to greater-than.

5. sam -- 2012-07-03 10:10

@anonymous I really suggest trying to get rid of the dead key feature (probably by switching from US-International to US-English); if you use a Compose key the dead keys become a lot less relevant and you could probably do without them.

6. anonymous -- 2012-07-06 20:03

The problem persists throughout all US layouts I've tried. I guess there is some setting activated somewhere else I don't know about.

7. mach -- 2012-08-28 11:14

I have written an implementation of the compose key that does not use the Cocoa text system, but a keyboard layout: This comes down to the compose key being a deadkey. By using a keyboard layout instead of the Cocoa text system, the compose key will work in any application.

I have taken the liberty of giving the compose the same assignment you have chosen: Ctrl+Shift+F13. Like that, your KeyRemap4MacBook will work as well. I hope that is OK.

8. sirdharma -- 2012-10-22 00:49

@sam I understand you that you "cannot imagine you could ever use any other input method" (as stated in your article), but out of curiosity have you ever tried the way OS X allows you to enter international characters (by default)?

Using the U.S. keyboard layout (not even U.S. International which activates dead keys), one can enter all the accents in a way that I find very natural. The whole idea is that the accents are obtained through the letter you would use that accent with most of the time. This makes it very fast to use, and very easy to remember:

Alt+e → ´
Alt+u → ¨
Alt+i → ˆ
Alt+n → ˜
Alt+c → ç (you would not need the cedilla in an other letter anyway)

If you want to see how the different modifiers affect the keyboard layout, one can get a visual representation by selecting "Keyboard & Character Viewer" in Preferences System → Language & Text → Input Sources, and then selecting "Show Keyboard Viewer" in the Input Menu in the menu bar.

I find very surprising that very few people seem to measure how powerful the Cocoa text system is. Give a try to Ctrl+a, Ctrl+e or Ctrl+t (inherited from Emacs I believe), or the subtle difference between Command+Left/Right (move to beginning/end of line) and Alt+Up/Down (move to beginning/end of paragraph). And I could not live without Alt+Left/Right (move one word left/right) and Alt+delete backward/forward (delete one word backward/forward). There are tons of example which actually makes my typing experience in OS X better than in Linux (one of the main reasons being that they are consistent across all Cocoa applications, i.e. 95% of the applications I use).

I may add that I am French and that my first name is François, so accented characters are of primary importance to me ;)

9. -- 2013-12-18 10:18

Just for simplicity, I made a ready-to-use setup for KeyRemap4MacBook. Enjoy!

10. anonymous -- 2013-12-18 10:23

BTW: --KeyToKey-- should be __KeyToKey__

11. Risenup -- 2014-07-02 18:56


12. -- 2014-08-22 19:23

I've got a real Sun keyboard attached to my Mac, with a real Compose key that I'd like to use instead of Right Option. I know that it send key code 0x6e when I hit it, but do you have any idea what I should call it in the XML snippet instead of "Right Option"?

13. -- 2014-08-22 19:37

Ah, figured it out myself, it's KeyCode::PC_APPLICATION

14. asedeno -- 2015-02-04 20:03

The problem with ^ (and ~, @, #, $) is that they are modifiers in DefaultKeyBinding.dict for Control (and Option, Command, Keypad, Shift). Even though they are written by Bob's tool in \UNNNN format, they still don't work right. Escaping them fixes it.

\U005E → \\\U005E (^)
\U007E → \\\U007E (~)
\U0040 → \\\U0040 (@)
\U0023 → \\\U0023 (#)
\U0034 → \\\U0024 ($)

Note that this escaping should only be applied to the keybindings, not to the insertText: directives.

15. -- 2015-03-25 16:53

Careful, your DefaultKeyBinding.dict starts with ~^$\UF710 which actually should be ^$\UF710 to mean Ctrl-Shift-F13. Please either revert, or update the recommended ~/Library/Application Support/Karabiner/private.xml to match (that's Karabiner instead of KeyRemap4MacBook) these days BTW)

16. sam -- 2015-09-05 19:37

@dominique thanks! I fixed the .dict.

17. anonymous -- 2015-09-06 14:41

KeyRemap4MacBook has been renamed to Karabiner...

253. anonymous -- 2016-10-28 20:24

Wow, spammers suck. Every comment since 18 is useless crap. :-(

254. suba hentai -- 2016-11-26 22:14

xyC2Fl I truly appreciate this post.Really thank you! Fantastic.

301. Full Article -- 2017-01-31 22:44

wvmisA I'а†ll right away take hold of your rss feed as I can not to find your email subscription hyperlink or newsletter service. Do you have any? Please let me recognise so that I could subscribe. Thanks.

303. More Help -- 2017-02-01 14:01

GwYw1E Im thankful for the article.Really thank you! Much obliged.

305. anonymous -- 2017-11-07 13:39

When the write key is applied with a key-board structure, it will continue to operate all over the OS in any program, not just in Cocoa programs as some shown at Dissertation Writing Service UK . It can be turned on and off with the UI by choosing another key-board structure and there is a visible reviews while writing the write combination

306. anonymous -- 2017-11-28 15:57

Play the most popular free online hearts card game one of the best sites for the players so have the full enjoyment to connect this link online create the best score to play this hard thanks for the visit here.

307. anonymous -- 2017-11-28 16:03

You play the amazing free cell online card game and i sure you create the full enjoy the most popular site for the players just click this link so have the full fun i sure you create the best score to play the hard thanks for the visit here.

308. WalcottZelda -- 2018-01-23 10:42

It may be turned on and off with the UI by means of selecting any other key-board shape and there is a visible evaluation while writing the write aggregate. You've got a real sun keyboard attached to my Mac, with an actual Compose key that I might like to apply as opposed to proper choice. This comes all the way down to the compose key being a lifeless key. by using a keyboard layout instead of the Cocoa textual content gadget, the compose key will work in any software. Dissertation Help Service London

309. anonymous -- 2018-02-28 12:56

Such a helpful guide, going from a PC to a Mac initially is very challenging. Our Eastwood driveway contractors company recently made the change and had been struggling to getting the compose key setup properly, so thanks for this guide!

310. anonymous -- 2018-03-03 18:18

hi there

311. HBS Case Study Solution -- 2018-03-10 13:41

Science Channel’s Are Giving A Complete Knowledge To Its Viewers About Every Thing Students Write Done Dissertation On This Subjects And Show Its Importance

312. anonymous -- 2018-03-11 20:43

Whenever I log into your blog I do find very interesting topics and informative articles published in it. This is the reason why I like visiting your blog very often. I even shared your blog link in my rushmyessay writers blog article where my friends also can come to know about your blog and have a look at it.

313. anonymous -- 2018-03-20 09:03

Very good post here. There are very useful information shared in this post. I am very happy to see this post and looking to see more good post.To get Garage Racking Click here

314. shawnjasper -- 2018-04-09 14:11

I want to change one of my keys on my keyboard to a Compose key so I can easily type common accents or characters <a href="">Assignment writing services</a>

315. anonymous -- 2018-05-08 13:13

My friend recommended this blog and he was totally right keep up the good work Such a nice post, keep up the fantastic work Civil Engineering Assignment Help Service

316. anonymous -- 2018-05-08 13:14

This site and the resources you provide is really nice keep it up. Such a nice post, keep providing good resources. Take My Online English Exam

317. anonymous -- 2018-05-08 14:44

Such a nice post, keep up the fantastic work This site and the resources you provide is really nice keep it up. Php From JS Assignment Help

318. Claude H. Blake -- 2018-06-08 09:47

I genuinely appreciated understanding it. Sitting tight for some more incredible articles like this from you in the nearing days.

319. subhan mahmud -- 2018-06-08 09:48

This is great information for students. This article is very helpful i really like this blog thanks. I also have some information relevant for online dissertation help.

320. John Martin -- 2018-06-08 09:51

The leading assignment help UK firm offers state of the art services to its clients with a promise of delivering all the required work well within the deadline.

321. -- 2018-06-08 12:28

Hire MyAssignmentHelp.Co.Uk will do your assignment online for you. They can directly place the order by using the online order form displayed on the homepage. Once students place their request for getting their assignments written by well-qualified experts, our operation sends them a free assignment quote. Avail best price and higher grades. When they agree to make the payment, the order gets confirmed.

322. -- 2018-06-29 09:35

I shall be thankful to you for the valuable info. hey can directly place the order by using the online order form displayed on the homepage. Once students place their request for getting their assignments written by well-qualified experts, our operation sends them a free assignment quote.

323. -- 2018-06-29 09:36

This comes down to the compose key being a deadkey. By using a keyboard layout instead of the Cocoa text system, the compose key will work in any application.

324. anonymous -- 2018-07-05 07:05

Students could often find it tough to write their academic tasks. It could lead to they not getting desired grades in the academics. Opting for our Assignment Help online could be ideal for such students and they can get a complete programming assignment help from us.

325. anonymous -- 2018-07-06 09:39

Waiting for marketing research paper assistance then visit at Students Assignment Help and collect all your queries resolved. Our writers our masters and Ph.D. level expert and work 24x7 for students assistance.

326. anonymous -- 2018-07-14 14:52

Good news. Appreciate this post. Thank you for compiling and sharing it.

329. Rooibos Tea -- 2018-08-25 17:39

This is my first time i visit here and I found so many interesting stuff in your blog especially it's discussion, thank you. Rooibos Tea

330. Raisins -- 2018-08-25 17:45

Really impressed! Everything is very open and very clear clarification of issues. It contains truly facts. Your website is very valuable. Thanks for sharing. Raisins

331. Kiwano -- 2018-08-25 17:46

When your website or blog goes live for the first time, it is exciting. That is until you realize no one but you and your. Kiwano

332. Head Lice -- 2018-08-25 17:47

This is a good post. This post gives truly quality information. I’m definitely going to look into it. Really very useful tips are provided here. Thank you so much. Keep up the good works Head Lice

333. Burn Fat -- 2018-08-25 17:48

I think I have never seen such blogs ever before that has complete things with all details which I want. So kindly update this ever for us. Burn Fat

334. Detox Water -- 2018-08-25 17:52

Writing with style and getting good compliments on the article is quite hard, to be honest.But you've done it so calmly and with so cool feeling and you've nailed the job. This article is possessed with style and I am giving good compliment. Best! Detox Water

335. Copper -- 2018-08-25 17:56

Personally I think overjoyed I discovered the blogs. Copper

336. anonymous -- 2018-08-30 04:46

I simply want to tell you that I am just beginner to blogs and absolutely enjoyed you’re website. More than likely I’m planning to bookmark your blog . You really come with awesome stories. Many thanks for sharing with us your web page. <a href="">Accounting Assignment Help New Zealand</a>

<a href="">Leadership Assignment Help New Zealand</a>

337. anonymous -- 2018-09-04 08:43
338. -- 2018-09-11 13:01

I really like this setting up real compose key and this article you had explained step by step.please see my page also:-

339. anonymous -- 2018-09-15 07:51

I found some useful stuff in your blog thanks for sharing and check out the link where you can get shopping discount coupons.

340. harry -- 2018-09-16 08:18

Your post is interesting and amazing. I feel happy after reading your post. Thanks for share! <a href="">i love you forever quotese</a>

341. -- 2018-09-17 08:47

Its a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome" Great work.

342. anonymous -- 2018-09-17 14:09

Thanks for sharning this information

Add New Comment