Rebind keys in macOS without Karabiner or Seil

I recently got my hands on a Logitech MX Keys keyboard, and found that connecting via Bluetooth didn’t let me change my modifier keys as I usually do with my Apple Wireless keyboard. Or any other, non-bluetooth keyboard really. I don’t know if this is on Apples part or Logitech’s, but connecting via Bluetooth the keyboard won’t show up in the drop down list of keyboards in the Modifier Keys-window. It does show up when connecting via the Unifying receiver, but not when using Bluetooth.

There are solutions for this, Karabiner-Elements being the most popular. I, however, am not a fan of technically having a keylogger installed on my computer for something as trivial as rebinding a key.

Luckily there is a way to remap keys natively since macOS 10.12; the hidutil terminal command. This command will for example rebind Caps Lock to act as left ctrl:

hidutil property --set '{"UserKeyMapping":

The command is pretty straight forward, you set a source and a destination for your mapping. A list of all keys available for remapping is available in Apple’s technical note 2450: TN2450

The rebind will be reset upon reboot though, but the following line will add the script as a login script:

sudo defaults write LoginHook /Users/yourusername/

Just add the hidutil command in a .sh file, run chmod +x on it and you’re good to go.

Leave a Reply

Your email address will not be published. Required fields are marked *