As seen in this article from Apple, you can remap a key from the command line in OS Sierra with something like:
hidutil property --set '{"UserKeyMapping":
[{"HIDKeyboardModifierMappingSrc":0x700000054,
"HIDKeyboardModifierMappingDst":0x700000067
}]
}'
Is it possible to assign this change only to a specific keyboard device, e.g. if you want to map one device to the output of a second, but not affect the function of the second?
The article is no longer updated and there appears to be no current documentation of how the command works.
I'm not quite sure what you mean by "if you want to map one device to the output of a second, but not affect the function of the second?", but the rest of your question sounds like you just want to remap a specific external device. This can be accomplished with the following command:
hidutil property --matching '{"ProductID":0x123}' --set '{"UserKeyMapping":
[{"HIDKeyboardModifierMappingSrc":0x700000054,
"HIDKeyboardModifierMappingDst":0x700000067
}]
}'
You'll need to determine your specific ProductID and insert it into the command above. You can find ProductIDs for internal and external devices at the following location:
Apple icon > About This Mac > System Report > USB (under Hardware section in left panel)
These changes will be reverted after each restart. In order to make this fix permanent, follow the solution provided in this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With