Karabiner-Elements
Remaps any key to any key, builds layers, and applies different rules per keyboard.
What it does
Karabiner-Elements sits below the application layer, so its remappings apply everywhere including login and recovery-adjacent contexts. Beyond simple swaps it supports:
- Complex modifications — conditional rules with JSON definitions, per-application or per-device.
- Layers — hold a key to turn the alphabet into arrows, media keys or symbols.
- Simultaneous keys and tap versus hold distinctions, so Caps Lock can be Escape when tapped and Control when held.
- Per-device profiles, which is what makes an external PC keyboard and the built-in one behave consistently.
Karabiner-EventViewer ships alongside it and shows the raw key codes a device is actually sending — the first stop when a key does not do what a rule expects.
Notes
It installs a driver extension and needs Input Monitoring permission; on Apple Silicon expect one approval and a reboot at install. Rules live in ~/.config/karabiner/karabiner.json, which is worth keeping in a dotfiles repository.
Alternative to
| Alternative | Type | Trade-off |
|---|---|---|
| Hammerspoon | Open source | Lua scripting for the whole system, keyboard included |
| BetterTouchTool | Paid | Broader: trackpad gestures, window snapping, remapping |
| Keyboard Maestro | Paid | Macro-first rather than key-first, and very powerful |
| Kanata | Open source | The same layer model as a cross-platform CLI daemon |
| QMK or ZMK firmware | Open source | Remapping in the keyboard itself, so it follows the hardware |
| System Settings → Keyboard → Modifier Keys | Built in | Enough for Caps Lock to Escape alone |
Install
brew install --cask karabiner-elements