This does turn out to be quite annoying.
I have just spent some time fossicking through all the various answers to this and have found a combination of things that is working for me nicely on Mac OS Ventura.
All details of this answer are on this Gist forked from a previous Gist answering this question, and are reproduced below.
How to get a real Compose key on OS X Ventura
1. Install the so-called "U.S. Custom" keyboard layout
This is just a "playground" custom keyboard layout for doing exactly what we're going to do, namely setting up a typical Linux style Compose key for an English keyboard.
As someone who isn't from the States, I personally don't love that this layout is called "U.S. Custom" but I suppose it's not too important.
- Download the ZIP file here
- Unzip the archive
- Copy the files to
~/Library/Keyboard Layouts
(note you can use Cmd+Shift+. to show the hidden ~/Library folder on Mac OS Finder if you like, saves you any terminal faffing)
- You will eventually need to restart your operating system, but you can do this later
2. Install Karabiner Elements
Install Karabiner Elements.
Note Karabiner expects you to enable various things in System Preferences (such as background modules for the "non-userspace" stuff that Karabiner appears to do). I simply assumed this would be okay as I am not very interested in opsec.
3. Configure the Caps Lock key as your new Compose key
I always use Caps Lock for Compose, not Right Command or another key as per some of these guides, because hey, I don't use it for Caps Lock.
This blog post is a useful overall reference for this part, and for this topic in general.
- Visit this online editor for "complex" Karabiner rules
- The preset config at the link has a pre-loaded Compose Key configuration (which is from the blog post above)
- Change the Compose Key, which is initially set to Right Command, to whatever you prefer
- Click "SHARE" and it'll prompt you to fire up Karabiner Elements from your browser to import the setting
- Don't forget to click "Enable" in Karabiner Elements Settings so as to actually fire up the imported Complex Rule
Note that what the imported Complex Rule actually does is spit out a Ctrl+Shift+F13 (ie a key combination you're highly unlikely to be using for anything else) when you hit your Compose Key, which can then be used by your overridden DefaultKeyBinding.dict
to insert the actual Unicode sequences when you hit "dead key" combinations.
4. Set up the Compose Key bindings
If you explore this topic you'll notice that various people have written scripts to output this DefaultKeyBinding.dict
file based on X11 configurations.
I use Compose heavily, but I really only use default settings, and I never run Perl or X11 these days, so I just downloaded a pre-cooked mapping file which can be obtained from this Gist file (again this is linked in the same blog post
- Create a user key bindings directory at
~/Library/KeyBindings
(this doesn't exist by default)
- Download the (raw) Gist contents and save them to
~/Library/KeyBindings/DefaultKeyBinding.dict
5. Restart your machine and set your Input Source
Note that before any of this will work, you will need to select the "U.S. Custom" keyboard layout you installed.
- Open System Preferences, search "Input Sources", open the dialog, click the "+", select "Others" as your language, and select "U.S. Custom" from the available options.
- If you can't see the option, make sure you didn't forget to restart and that you put the files downloaded in section (1) above in the right location.
- Having added the "U.S. Custom" Input Source, select it as your current Input Source and click Done.
6. Test it works
My personal most used Compose combination might be the single character ellipsis, which is mapped to CapsLock,-,-,- and gives me … … … get it?