How to use Kanata from Homebrew and LaunchCtl for macOS #1537
Replies: 11 comments 17 replies
-
This worked fine. For some reason after updating kanata, I had to remove and then re add and enable kanata on System Settings > Privacy & Security > Input Monitoring But it worked after that. |
Beta Was this translation helpful? Give feedback.
-
Is it possible to use this same method when installing Kanata through cargo? I've tried to do this but have so far been unsuccessful. I've changed the path to kanata in the I tried to install it with cargo so that I could install the cmd allowed version as I was unable to install that version with Homebrew (I wasn't able to find out if this is possible with Homebrew). I would be grateful for any help, Thanks!! |
Beta Was this translation helpful? Give feedback.
-
Hello Thomas, how do you ensure that the karabiner plists run in order? First the "activate" of the manager then the background daemon and then the kanata process? Thanks in advance! Michael. |
Beta Was this translation helpful? Give feedback.
-
Thank you for putting this document together. It is a great start. I ran into a snag though. Details for others who might run into this. I have installed the Karabiner driver as per their page. I have seen the example run and take over the mouse and then emit "egggggg". So far so good. I then made /Library/LaunchDaemons/com.example.karabiner-vhiddaemon.plist and copied in your plist data. When I try to run launchctl I get no luck:
Which is about as helpful as that error 6 above. https://developer.apple.com/forums/thread/665661 had a bunch of spaghetti being thrown at the wall. Reading through them all I found someone talking about permissions. In the end, permissions on the file were the issue. Ensuring the plist files are owned by root and wheel made things happy. The examples show this in the |
Beta Was this translation helpful? Give feedback.
-
This guide works fine in macOS 15.5 beta2, but not in macOS 15.5 beta3. |
Beta Was this translation helpful? Give feedback.
-
Applied the guide on MacOS Sequoia 15.5 with success. Had to create the .plist files in my home folder as told by @shaleh to make it work.
EDIT: correction, it doesn't was Karabiner-elements that prevented kanata to start with launchctl. I suppose it starts before karabiner when I boot, nullifying the issue. |
Beta Was this translation helpful? Give feedback.
-
For me the first time the setup was not working. I did all kinds of hacky stuff that I really don't understand properly. Nothing worked. Then I decided to install Karabiner Elements and leave Kanata. But then I noticed that the latest version of Karabiner Elements also installs the Karabiner-DriverKit-VirtualHIDDevice-5.0.0.pkg package instead of the Karabiner-DriverKit-VirtualHIDDevice-6.0.0.pkg at the time of posting this. I initially used v6 thinking that's the latest version available to me at this moment, so that would be the best thing to do. Then I uninstalled the Karabiner Elements again. Then installed the v5 of the Karabiner Driver Kit. Followed the setup guide once again. This time it worked. But at the modifier keys section of the guide I am not seeing the Karabiner in the list of devices. But it now works, I am happy with that. Thanks OP for the setup guide. |
Beta Was this translation helpful? Give feedback.
-
I keep getting this error shown below.
I'm using sudo to create the files in the LaunchDaemon folder. Does anyone know how to fix this? Thanks in advance |
Beta Was this translation helpful? Give feedback.
-
Hi, @thomastthai, @michaelrommel. Firstly, thank you for this comprehensive guide for settings up kanata on macos. I am stuck in the final stage of the installation. I suspect that some other application is using the HID which is causing the error. Also, I am unable to find the Kanata log file that should be generated from I have used your configs and made changes according to my user. I am trying to look for the file here: The console logs when running ![]() I have also paid a close attention to the System Settings and enabled Kanata and iTerm (where I'm running kanata) both in Accessibility and Input Monitoring under Privacy & Security. I have noticed that I didn't have the karabiner_grabber that is present in your settings but suspect that it's because you had installed Karabiner-Elements also, that I didn't have. Finally, I'm running Kanata v1.19.0, Karabiner-DriverKit-VirtualHIDDevice-6.0.0.pkg or v1.8.0, on MacOS ProductVersion: 15.3.2. Please help how I can debug this further. |
Beta Was this translation helpful? Give feedback.
-
Because someone ran into a similar issue on MacOS, I published the Raycast scripts that I use to control Kanata. Also threw in a command to view the last 100 lines of the error log for debugging. Stop, Start, and Restart kanata using Raycast. Instructions inside: |
Beta Was this translation helpful? Give feedback.
-
I wrote a script to automate all of this: Kanata Gist If you need more details:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The following installation and configuration steps are tested on macOS Sequoia 15.3.x.
Install Karabiner-DriverKit-VirtualHIDDevice
*.pkg
file, GitHub may take you to another page with "View raw" link to download it.Install Kanata
Execute the following command in your terminal:
Manually test your
kanata
configuration to make sure it works before proceeding to configurekanata
to launch at startup.Edit startup files for LaunchCtl
Create and edit three files in
/Library/LaunchDaemons/
using your favorite text editor:/Library/LaunchDaemons/com.example.kanata.plist
:Customize the settings you need in the section below. These are the same switches or flags and values you would use with
kanata
in the terminal./Library/LaunchDaemons/com.example.karabiner-vhiddaemon.plist
:/Library/LaunchDaemons/com.example.karabiner-vhidmanager.plist
:Configure starting Kanata for LaunchCtl
Execute the following command in your terminal:
Kanata will start on reboot with those commands. If you want to start
kanata
manually now:Configure starting Karabiner-DriverKit-VirtualHIDDevice for LaunchCtl
Execute the following command in your terminal:
vhiddaemon
andvhidmanager
will start on reboot with those commands. If you want to start them now manually now:Set macOS to use the virtual keyboard
Navigate to your System Settings > Keyboard > Keyboard navigation > Keyboard Shortcuts:
In your keyboard
Modifier Keys
setting, selectKarabiner DrivrKit VirtualHIDKeyboard x.x.x
from the drop-down menu.Set macOS to allow your terminal and
kanata
to monitor input from your keyboardNavigate to your System Settings > Privacy & Security > Input Monitoring
If your terminal and
kanata
aren't listed, click on the+
button to add them. Locate each application from the popup finder window and choose them. Sincekanata
was installed by Homebrew or if you installedkanata
from source, you may need to type in the path tokanata
manually using the keyboard shortcut Shift+Command+G while in the Finder file browser, e.g.,/opt/homebrew/bin/kanata
. On my system,/opt/homebrew/bin/kanata
is a symbolic link to the actual location and macOS follows that link. If you choosekanata
from the actual installed location, you may need to redo this step since each upgrade is placed in a separate version folder, e.g., 1.8.0, 1.8.1.Set macOS Accessibility access to allow Kanata and your terminal to control your computer
Navigate to your System Settings > Privacy & Security > Accessibility:
Additional notes
Some users reported conflicts when using Karabiner-Element and Kanata at the same time. Karabiner-Element hogs the virtual keyboard device and doesn't allow
kanata
to access it.If you want to test
kanata
from your CLI manually, you need to run it withsudo
or else you'll get theIOHIDDeviceOpen error: (iokit/common) privilege violation
error, e.g.,Error when running without
sudo
:No error when running with
sudo
:Beta Was this translation helpful? Give feedback.
All reactions