jtroo / kanata

Improve keyboard comfort and usability with advanced customization
GNU Lesser General Public License v3.0
2.14k stars 110 forks source link

Bug: IOHIDDeviceOpen error: (iokit/common) not permitted #1211

Open aljustiet opened 2 weeks ago

aljustiet commented 2 weeks ago

Requirements

Describe the bug

Can't run the kanata. having permission related issue When I run:

sudo kanata --nodelay --cfg ~/Documents/mac-arch/kanata.lsp

I get:

2024-08-27T22:38:02.385497+05:00 [INFO] kanata v1.6.1 starting
2024-08-27T22:38:02.386648+05:00 [INFO] process unmapped keys: true
2024-08-27T22:38:02.387009+05:00 [INFO] NOTE: kanata was compiled to never allow cmd
2024-08-27T22:38:02.389551+05:00 [INFO] config file is valid
2024-08-27T22:38:02.389593+05:00 [INFO] entering the processing loop
2024-08-27T22:38:02.389608+05:00 [INFO] entering the event loop
2024-08-27T22:38:02.389615+05:00 [INFO] Starting kanata proper
2024-08-27T22:38:02.389618+05:00 [INFO] You may forcefully exit kanata by pressing lctl+spc+esc at any time. These keys refer to defsrc input, meaning BEFORE kanata remaps keys.
IOHIDDeviceOpen error: (iokit/common) not permitted
IOHIDDeviceOpen error: (iokit/common) not permitted
IOHIDDeviceOpen error: (iokit/common) not permitted
2024-08-27T22:38:02.404165+05:00 [ERROR] failed to open keyboard device(s): Couldn't register any device

Press enter to exit
2024-08-27T22:38:02.404174+05:00 [ERROR] channel disconnected

Relevant kanata config

https://rentry.co/4qvbsknp/raw

To Reproduce

  1. Open terminal
  2. Run kanata --cfg config.kbd
  3. Get an error

Expected behavior

Shouldn't have error

Kanata version

kanata 1.6.1

Debug logs

2024-08-27T22:48:30.251437+05:00 [INFO] kanata v1.6.1 starting
2024-08-27T22:48:30.252508+05:00 [INFO] process unmapped keys: false
2024-08-27T22:48:30.252827+05:00 [INFO] NOTE: kanata was compiled to never allow cmd
2024-08-27T22:48:30.252833+05:00 [DEBUG] (1) kanata_parser::cfg::alloc: freeing allocations of length 0
2024-08-27T22:48:30.255348+05:00 [INFO] config file is valid
2024-08-27T22:48:30.255394+05:00 [INFO] entering the processing loop
2024-08-27T22:48:30.255407+05:00 [INFO] entering the event loop
2024-08-27T22:48:30.25542+05:00 [INFO] Starting kanata proper
2024-08-27T22:48:30.255424+05:00 [INFO] You may forcefully exit kanata by pressing lctl+spc+esc at any time. These keys refer to defsrc input, meaning BEFORE kanata remaps keys.
IOHIDDeviceOpen error: (iokit/common) not permitted
IOHIDDeviceOpen error: (iokit/common) not permitted
IOHIDDeviceOpen error: (iokit/common) not permitted
2024-08-27T22:48:30.27162+05:00 [ERROR] failed to open keyboard device(s): Couldn't register any device

Press enter to exit
2024-08-27T22:48:30.271629+05:00 [ERROR] channel disconnected
2024-08-27T22:48:30.271657+05:00 [DEBUG] (2) kanata_parser::cfg::alloc: freeing allocations of length 2983

Operating system

MacOS Sonoma 14.6.1

Additional context

Installed using cargo.

rsomani95 commented 2 weeks ago

I'm facing the same error (I'm also on macOS Sonoma 14.6.1). I installed via the binary in the Releases. I've cycled through some other issues that discuss this but none of the suggestions worked there either.

I verified that the dext part of the installation happened correctly as I can see the virtual keyboard in system settings: CleanShot 2024-08-31 at 15 17 45@2x

Additionally, I verified the version like so:

> defaults read /Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/Info.plist CFBundleVersion
3.1.0
Reucherian commented 1 week ago

This error is likely due to macOS's TCC (Transparency, Consent and Control). Under Settings > Privacy and Security > Input Monitoring Check if Kanata (and/or the terminal of your choice is present along with karabiner)

Screenshot 2024-09-03 at 2 10 55 PM

Adding the Kanata binary ( from ~/.cargo/bin/kanata especially if you're using it as a launch daemon) and adding your terminal to this list should solve the issue.

rsomani95 commented 1 week ago

@Reucherian i believe i've set that up correctly. Here's what my input monitoring window looks like:

CleanShot 2024-09-03 at 15 06 37@2x

Still doesn't resolve the issue for me

rsomani95 commented 1 week ago

I noticed you have a karabiner_observer, which I'm missing. Is that something you added explicitly? If so, how does one go about doing it?

Reucherian commented 1 week ago

That is not something I added explicitly. Are you certain that kanata or the terminal application you use is on this list? I don't see either in the screenshot.

To add a new application you can click the + button on the bottom and either drag the application to the new finder window or navigate to it using that window.