OS X makes it easy to type accented characters by simply holding down the letter you want accented. If you hold down
c (for example) you’ll see this:
Well, I do. You probably don’t see that 4th option: “ĉ”, and that’s what this post is about. I needed to add that, and others to support typing in Esperanto without switching to a different language keyboard. This technique is also useful if there is a language keyboard you want to use but it doesn’t have the Press and Hold support you want.
Here’s the deal though. The files you need to edit, are in an area of the system that Apple has locked down so hard that even the root user can’t touch it. Normally the
root user can do anything it feels like. You’ll need to temporarily disable System Integrity Protection and run a few commands in the terminal to replace the XML file that defines what characters show up in the Press and Hold menus. You’ll need a developer’s text editor (not Text Edit), and knowledge of how to copy and move files on the command line.
If that’s all gobbledygook and/or scary to you, then you should probably stop here. I’m sorry. Apple’s made this a geek-only operation.
Still here? Good.
Here Be Dragons
There’s a system folder in which You’ll find a variety of files. We need to modify the file in there that corresponds to your default language. If you’re reading this your default language is probably English, so you’ll want to
Keyboard-en.plist (“en” for English). If not, find the file with the 2 letter abbreviation that corresponds to your system’s language.
In El Capitan this folder is here
In Sierra this folder is here
If you just want to add Esperanto character’s to your English Press and Hold menus
then download this file (right click, save as
Keyboard-en.plist) and skip down to the part about Disabling System Integrity
Modifying your Press and Hold plist file.
Once you’ve found the appropriate file copy it into another directory and start editing. You can’t edit it in place.
First find the
<key>...</key> line that corresponds to the key you want to edit. When I went to add a capital C with a caret over it I found the
<key>Roman-Accent-C</key> line, then edited the
<dict>...</dict> block below it. I’m fairly certain that the first character must not be changed. The other characters are the ones that will show up in the Press and Hold pop-up. Modify them however you want. You can even put emoticons in there. I just modified to have the
Ĉ you see below. Note that there are spaces between each character. What happens if you string multiple letters together without a space? Dunno. I’m betting you’ll get an entire word for an item in the menu.
<key>Roman-Accent-C</key> <dict> <key>Direction</key> <string>right</string> <key>Keycaps</key> <string>C Ç Ć Č Ĉ</string> <key>Strings</key> <string>C Ç Ć Č Ĉ</string> </dict>
Once you’ve modified all the uppercase and lowercase versions of the letters you want the pop-up for it’s time to replace the original. I recommend making a back-up first. Just in case.
Temporarily disabling System Integrity Protection
You’ll probably want to print out / write down these instructions because you won’t be seeing them after restarting.
Restart your computer. Hold down the “Command” key and the “R” key when you hear the restart sound. You’ll see a progress bar as it boots you into Recovery Mode. Ignore the window listing backups and disk utility. Click on the “Utilities” menu, and choose Terminal.
Disable SIP and reboot (to make it take effect).
csrutil disable; reboot
Log in, then run this for El Capitan
sudo cp path/to/your/edited/Keyboard-en.plist /System/Library/Input\ Methods/PressAndHold.app/Contents/Resources/Keyboard-en.plist
or this for Sierra & High Sierra
sudo cp path/to/your/edited/Keyboard-en.plist /System/Library/Input\ Methods/PressAndHold.app/Contents/PlugIns/PAH_Extension.appex/Contents/Resources/
Reboot and go back into Recovery Mode. Open up the Terminal again, and run
csrutil enable; reboot
That’s it. You’re done. Now your customized popover will be available to any keyboard in your default language.