Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Oneechan69

macrumors 6502
Original poster
hidutil seems much more complicated to use as a CLI or with scripts or config files (however you do it) compare to using apps that make the process much easier.
 
I run the following script as a LaunchAgent, so it gets applied automatically when I log in. Works fine and I haven't had to think about it for a long time, so I would say a benefit is that it's rock solid.

Code:
#!/usr/bin/env bash

# REF: https://developer.apple.com/library/archive/technotes/tn2450/_index.html

# Remap:
#   RightCmd  -> F17
#   CapsLock  -> F16
#   RightCtrl -> F15
hidutil property --set '
{
    "UserKeyMapping": [
        {
            "HIDKeyboardModifierMappingSrc":0x7000000e7,
            "HIDKeyboardModifierMappingDst":0x70000006c
        },
        {
            "HIDKeyboardModifierMappingSrc":0x700000039,
            "HIDKeyboardModifierMappingDst":0x70000006b
        },
        {
            "HIDKeyboardModifierMappingSrc":0x7000000e4,
            "HIDKeyboardModifierMappingDst":0x70000006a
        }
    ]
}' >/dev/null

Using hidutil like this is about very simple 1:1 key remappings though. It has nothing to say about specific key combinations including modifier keys etc.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.