`hidutil` stopped working on macOS 14.2

I've got the following command to run on every macOS start:


hidutil property --set '{"UserKeyMapping": [{"HIDKeyboardModifierMappingSrc": 0x700000064, "HIDKeyboardModifierMappingDst": 0x700000035}]}'


It always rebinds a key on my international Apple Magic Keyboard to a convenient one to match with my us keyboard laptop.


Right after 14.2 install this command stopped working. It throws no error, the


hidutil property --get UserKeyMapping


prints out some kind a valid output as follow, but the key behaviour isn't updates after the command run as it appears before update. Also I'm not sure that in the past the --get argument output was printed out as a Decimal rather than hex. But this is as it is now.


The command output:


(
        {
        HIDKeyboardModifierMappingDst = 30064771125;
        HIDKeyboardModifierMappingSrc = 30064771172;
    }
)

MacBook Pro (M1, 2020)

Posted on Dec 12, 2023 4:21 AM

Reply
Question marked as Best reply

Posted on Dec 18, 2023 1:33 AM

UserKeyMapping with hidutil is no longer working for me after upgrading to 14.2. I'm on a restrict macOS where it's not allowed to install third-party software.


I need to map these keys § <=>`, and ± <=> ~ which swap some special keys from Norwegian keyboard layout to US keyboard layout. Even I did change the layout to US in Keyboard settings but it didn't help for those keys. hidutil was really helpful to map them. Now, it's gone. This impacts my daily work's speed.


UserKeyMapping:(
        {
        HIDKeyboardModifierMappingDst = 30064771172;
        HIDKeyboardModifierMappingSrc = 30064771125;
    },
        {
        HIDKeyboardModifierMappingDst = 30064771125;
        HIDKeyboardModifierMappingSrc = 30064771172;
    }
)
50 replies
Question marked as Best reply

Dec 18, 2023 1:33 AM in response to yaroslav280

UserKeyMapping with hidutil is no longer working for me after upgrading to 14.2. I'm on a restrict macOS where it's not allowed to install third-party software.


I need to map these keys § <=>`, and ± <=> ~ which swap some special keys from Norwegian keyboard layout to US keyboard layout. Even I did change the layout to US in Keyboard settings but it didn't help for those keys. hidutil was really helpful to map them. Now, it's gone. This impacts my daily work's speed.


UserKeyMapping:(
        {
        HIDKeyboardModifierMappingDst = 30064771172;
        HIDKeyboardModifierMappingSrc = 30064771125;
    },
        {
        HIDKeyboardModifierMappingDst = 30064771125;
        HIDKeyboardModifierMappingSrc = 30064771172;
    }
)

Dec 12, 2023 8:08 AM in response to yaroslav280

yaroslav280 wrote:

Thanks, is there any hints how's that config should be installed properly?

You put the .keylayout file in Library/Keyboard Layouts or Home/Library/Keyboard Layouts. Then you go to system settings > keyboard > text input > edit > input sources and use the + button to add it to the list (look in the Others category). Then you select it in the input menu at the top right of the screen.

Feb 4, 2024 8:24 AM in response to kemalizing

here is an example of my config. replace <vendor_id_value> and <product_id_value> values which can be found via the system report tool as per Get system information about your Mac. so essentially the only things that changed were adding sudo and changing my id values for my internal kb:

<!-- place in /Library/LaunchDaemons and run sudo launchctl start com.hidutilKeyMapping -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>com.hidutilKeyMapping</string>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/bin/sudo</string>
      <string>/usr/bin/hidutil</string>
      <string>property</string>
      <string>--matching</string>
      <string>{"VendorID": <vendor_id_value>, "ProductID": <product_id_value>}</string>
      <string>--set</string>
      <string>{
        "UserKeyMapping": [
            {
              "HIDKeyboardModifierMappingSrc": 0x70000002A,
              "HIDKeyboardModifierMappingDst": 0x700000031
            },
            {
              "HIDKeyboardModifierMappingSrc": 0x700000031,
              "HIDKeyboardModifierMappingDst": 0x70000002A
            }
        ]
      }</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
  </dict>
</plist>

Jan 15, 2024 11:33 PM in response to huyngkh

Hello, I encounted the same problem, but I solved it successfully using hidutil.

STEPS:

  1. remove the usb of keyboard on the mac
  2. restart the computer
  3. the hidutil does not work right now
  4. plug the usb of our keyboard, then the hidutil will write the config to macos immediately in 1 second.

I think that hidutil bonded with certain device(my keyboard), so when I plug usb in, hidutil writed the config to computer. But if I donot plug the usb in(or donot remove the usb when I restart computer), the write event do not happen, looks like that macos do not allow modify the keyboard on macbook, but allow modify the keyboard third-party

Jan 17, 2024 2:24 PM in response to yaroslav280

And I've got the answer from Apple on my issue about that.


They said that the problem is fixed.


I've tried to reproduce it on my laptop and it persists, yet it gets with a lower severity, as now (as the one mentioned somewhere above) binding starts working but after replugging the device. I can add that this is true for a wireless devices as well. My binding started working after I reenabled Bluetooth. This fix worked for me a few times in the row, so I consider it as a persistent.


Nonetheless I've objected Apple's claim that the issue has been solved. So let's see what's happens next.

`hidutil` stopped working on macOS 14.2

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.