A minimal macOS CLI utility to switch keyboard input methods programmatically — fast and reliable for scripting, automation, and hotkeys.
Works around macOS bug with "candidate box" input methods (e.g., Japanese IME).
brew tap postrockreverb/tap
brew install input-method-select
input-method-select com.apple.keylayout.ABC
input-method-select com.apple.inputmethod.Kotoeri.RomajiTyping.Japanese
make
This will create:
- dist-arm64/input-method-select (for Apple Silicon)
- dist-x86_64/input-method-select (for Intel Macs)
If your input method displays a candidate window (like many East Asian input methods), macOS sometimes fails to fully switch using only the system API.
To fix this, whenever you’re switching from ABC input method, the following sequence will be applied:
- Switch to your target input method
- Switch back to ABC
- Switch again to the target input method
If you are NOT switching from ABC, the normal switch is sufficient.
MIT