Last time, I described how I moved from Google Japanese Input to the macOS standard IME, only to run into trouble because its romaji table cannot be edited.

This time, I'll explain the thinking behind Karabiner-Elements — the tool I used to solve that problem — and the steps to set it up.

What is Karabiner-Elements?

Karabiner-Elementsとは?の解説画像

Karabiner-Elements is a keyboard customization tool for macOS.

For example,

Caps Lock → Control

— but it can do more than simple key swaps like that. For example, it can:

  • Change how keys behave only in specific apps
  • Perform special processing only while Japanese input is active
  • Produce a different input from a combination of keys

Complex controls like these are also possible.

It can also handle processing like the kind covered in this series: treating a keystroke as a different input only when a specific vowel follows C.

Why you shouldn't simply change C to K

単純に「CをKへ変更」してはいけないの解説画像

At first, it seems like you could simply set

C → K

and be done with it.

That way,

co
↓
ko
↓
こ

is what you would get.

However, this approach would also break existing romaji input such as

cho → ちょ

.

C — if converted unconditionally into K — then

cho
↓
kho

would be the result.

So instead, when C is pressed, we hold off for a moment and check the next key.

What we want to change this time is

ci → き
cu → く
co → こ

only.

In all other cases, C is passed through as-is.

That's why

cho → ちょ
cha → ちゃ
chu → ちゅ

and similar inputs keep working exactly as before.

The same goes for X: only

xi → ひ
xo → ほ

gets special treatment.

Installation

インストールの解説画像

Install Karabiner-Elements from the official website.

After installation, macOS may require permissions such as Accessibility or driver extension approval.

When you launch Karabiner-Elements, it will show you the required permissions, so follow the prompts to grant them.

The on-screen appearance may vary depending on your versions of macOS and Karabiner-Elements.

Installing the actual Karabiner configuration

実際のKarabiner設定を入れるの解説画像

Karabiner-Elements has a feature called Complex Modifications that lets you add custom rules in JSON format.

Configuration files you add yourself normally go in

~/.config/karabiner/assets/complex_modifications/

.

To open it from Finder, choose

Finder → Go → Go to Folder

and enter

~/.config/karabiner/assets/complex_modifications/

.

There, place the

apple_japanese_custom_romaji_v4.json

file distributed in this series.

Next, open Karabiner-Elements and, from

Complex Modifications → Add predefined rule

, enable

Apple日本語入力 カスタムローマ字 v4

.

Inputs affected by this configuration

この設定で変わる入力の解説画像

This time, only the following five inputs get special treatment on the Karabiner side.

ci → き
cu → く
co → こ
xi → ひ
xo → ほ

Everything else uses the macOS standard IME's input handling as-is.

Ultimately, this means

か → ka
き → ci
く → cu
け → ke
こ → co
は → ha
ひ → xi
ふ → fu
へ → he
ほ → xo

is what you end up typing.

Also, existing inputs such as

cho → ちょ
cha → ちゃ
chu → ちゅ

continue to work as well.

Next time, I'll cover the limitations of this approach, what to check when it doesn't work, and an overall wrap-up.