[SOLVED] HID permissions in OSX

I’d like to access keyboard events with HID, but I keep getting this error when trying to open it:

HIDAPI : Unable to open device USB_046d_c31c_fd143410: 1133, 49948
ERROR: HID: Could not open device

I’ve tried with all listed devices with both HID.open(...) and HID.openAt(...)

The documentation states that this might be an issue with permissions, and gives a solution for changing them in Linux, but that solution is not possible in OSX. I haven’t found a way to change device permissions on OSX. Has anybody run into this and solved it?


I managed to solve this. I’m posting the solution in case it might help others.

There are two things to be done:

  1. In order to open the device with permissions, Supercollider must be launched as root. I did it from the terminal with sudo /Applications/SuperCollider/SuperCollider.app/Contents/MacOS/SuperCollider.

  2. To be able to use the keyboard events, add Supercollider to Enable access for assistive devices in System Preferences > Security & Privacy > Privacy > Accessibility

Does this enable you to always monitor your keystrokes even when, say, another application is in focus?

Example: Keystrokes are sent to SuperCollider while writing in TextEdit.

Sorry, I haven’t tried that