2

I used the hidutil function to remap several keys on my keyboard:

hidutil property --set '{"UserKeyMapping":
    [{"HIDKeyboardModifierMappingSrc":0x70000003e,
      "HIDKeyboardModifierMappingDst":0x70000004c},
     {"HIDKeyboardModifierMappingSrc":0x70000004c,
      "HIDKeyboardModifierMappingDst":0x70000003e} ,   
     {"HIDKeyboardModifierMappingSrc":0x70000003f,
      "HIDKeyboardModifierMappingDst":0x70000002a},
     {"HIDKeyboardModifierMappingSrc":0x70000002a,
      "HIDKeyboardModifierMappingDst":0x70000003f}]
}'

My problem is that I made some mistakes in it, and I don't find the way to restore it.

2

To reset the key mapping(s) back to default, simply make the "destination" the same as the "source"

For example,

hidutil property --set'{"UserKeyMapping": [{"HIDKeyboardModifierMappingSrc":0x70000003e,
  "HIDKeyboardModifierMappingDst":0x70000003e}]'
  • Glad it worked for you! – Allan Feb 15 at 17:33
2

According to the help of the command, the content must be valid JSON. But setting the property to null takes no effect.. Instead, I found empty string actually works:

hidutil property --set '{ "UserKeyMapping":"" }'

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .