百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
K

Karabiner-DriverKit-VirtualHIDDevice

> 编程语言
开源

Karabiner-DriverKit-VirtualHIDDevice 这个项目在 macOS 上使用 DriverKit 实现了虚拟键盘和虚拟鼠标。这些虚拟设备可以用于在 macOS 上运行的 Windows 应用程序。

365 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

Karabiner-DriverKit-VirtualHIDDevice 这个项目在 macOS 上使用 DriverKit 实现了虚拟键盘和虚拟鼠标。这些虚拟设备可以用于在 macOS 上运行的 Windows 应用程序。

Karabiner-DriverKit-VirtualHIDDevice

This project implements a virtual keyboard and virtual mouse using DriverKit on macOS. These virtual devices are recognized by macOS as same as physical hardware, allowing you to control macOS with keystrokes and mouse inputs from the virtual devices.

The client for controlling the virtual devices is provided as a header-only C++ library. By integrating this library, your software can control the virtual devices.

Note: The ability to send keystrokes and mouse inputs means having full control over macOS. Therefore, to prevent malicious software from manipulating the virtual devices, the virtual devices will only accept commands from processes running with root privileges. This means that the software incorporating the client library must be run with root privileges.

Supported systems

  • macOS 26 Tahoe
    • Both Intel-based Macs and Apple Silicon Macs
  • macOS 15 Sequoia
    • Both Intel-based Macs and Apple Silicon Macs
  • macOS 14 Sonoma
    • Both Intel-based Macs and Apple Silicon Macs
  • macOS 13 Ventura
    • Both Intel-based Macs and Apple Silicon Macs

Screenshots

  • macOS Settings (macOS detects the virtual keyboard)

Usage

  1. Open dist/Karabiner-DriverKit-VirtualHIDDevice-x.x.x.pkg.

  2. Install files via installer.

  3. Execute the following command in Terminal.

    bash
    /Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Manager activate
  4. Run Karabiner-VirtualHIDDevice-Daemon:

    bash
    sudo '/Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/Applications/Karabiner-VirtualHIDDevice-Daemon.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Daemon'
  5. Run a client program to test the driver extension.

    bash
    git clone --depth 1 https://github.com/pqrs-org/Karabiner-DriverKit-VirtualHIDDevice.git
    cd Karabiner-DriverKit-VirtualHIDDevice/examples/virtual-hid-device-service-client
    brew install xcodegen
    make
    make run

Uninstallation

  1. Run uninstaller in Terminal.

    bash
    bash '/Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/scripts/uninstall/deactivate_driver.sh'
    sudo bash '/Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/scripts/uninstall/remove_files.sh'
    sudo killall Karabiner-VirtualHIDDevice-Daemon

Installed files

  • /Applications/.Karabiner-VirtualHIDDevice-Manager.app
  • /Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice
  • /Library/Application Support/org.pqrs/tmp
  • /var/log/karabiner

How to build a package from source code

To run DriverKit drivers, simply building from the code is not sufficient; proper signing is also necessary. In particular, a general developer account lacks the necessary permissions for DriverKit signing, so you need to apply to Apple for higher privileges. The primary focus of this document is on signing.

System requirements

  • macOS 15+
  • Xcode 16.3+
  • Command Line Tools for Xcode
  • XcodeGen

Obtain DriverKit entitlements

To create an App ID that supports the com.apple.developer.driverkit entitlement required for distributing DriverKit drivers, you need to apply to Apple with your developer account to obtain the necessary permissions.

Specifically, follow the instructions on Requesting Entitlements for DriverKit Development

Note: This process may take some time to be completed on Apple's side.

Create App IDs

Create the following App IDs on the Apple Developer site.

        Bundle ID
        Capabilities
        App Services
        Additional Capabilities
    



    

        org.pqrs.Karabiner-DriverKit-VirtualHIDDevice
        ---
        ---
        
            com.apple.developer.driverkit

            com.apple.developer.driverkit.family.hid.device

            com.apple.developer.driverkit.family.hid.eventservice

            com.apple.developer.driverkit.transport.hid

            com.apple.developer.hid.virtual.device

        
    

    

        org.pqrs.Karabiner-VirtualHIDDevice-Daemon
        ---
        ---
        ---
    

    

        org.pqrs.Karabiner-VirtualHIDDevice-Manager
        
            System Extension

        
        ---
        ---

Grant permission for com.apple.developer.driverkit.userclient-access from Apple

The entitlement of com.apple.developer.driverkit.userclient-access must be applied for from Apple, and unless individually authorized, it cannot be granted to your application. You can apply through the request form:

Create a profile corresponding to the App IDs on the Apple Developer site

Profile App ID Entitlements
Developer ID org.pqrs.Karabiner-DriverKit-VirtualHIDDevice DriverKit and System Extension Template for XXXXXXXX (Developer ID)
Developer ID org.pqrs.Karabiner-VirtualHIDDevice-Daemon DriverKit and System Extension Template for XXXXXXXX (Developer ID)
Developer ID org.pqrs.Karabiner-VirtualHIDDevice-Manager Default

Please ensure that com.apple.developer.driverkit.userclient-access appears under Extended Entitlements when you select DriverKit and System Extension Template in Entitlements.

Replace the *.provisionprofile files in the repository with your own provision profile files

  • src/Daemon/Developer_ID_KarabinerVirtualHIDDeviceDaemon.provisionprofile
  • src/DriverKit/Developer_ID_KarabinerDriverKitVirtualHIDDevice.provisionprofile
  • src/Manager/Developer_ID_KarabinerVirtualHIDDeviceManager.provisionprofile

Replace team identifier, domain and embedded.provisionprofile

Search G43BCU2T37 and replace them with your team identifier.

bash
git grep G43BCU2T37 src/

Open Terminal.app to create a package

The rest of the operations will be performed in the terminal.

Set environment variables for signing

Set the following environment variables for application signing and package signing.​

  • PQRS_ORG_CODE_SIGN_IDENTITY
  • PQRS_ORG_INSTALLER_CODE_SIGN_IDENTITY

You can determine the values using the following methods:

Find the value for PQRS_ORG_CODE_SIGN_IDENTITY:

bash
security find-identity -p codesigning -v | grep 'Developer ID Application'
    2) BD3B995B69EBA8FC153B167F063079D19CCC2834 "Developer ID Application: Fumihiko Takayama (G43BCU2T37)"

Then, set PQRS_ORG_CODE_SIGN_IDENTITY

bash
export PQRS_ORG_CODE_SIGN_IDENTITY=BD3B995B69EBA8FC153B167F063079D19CCC2834

Find the value for PQRS_ORG_INSTALLER_CODE_SIGN_IDENTITY:

bash
security find-identity -p basic -v | grep 'Developer ID Installer'
  1) C3107C61DB3605DA2D4549054B225DAFB1D6FA2D "Developer ID Installer: Fumihiko Takayama (G43BCU2T37)"

Then, set PQRS_ORG_INSTALLER_CODE_SIGN_IDENTITY

bash
export PQRS_ORG_INSTALLER_CODE_SIGN_IDENTITY=C3107C61DB3605DA2D4549054B225DAFB1D6FA2D

Build a package

bash
make package

dist/Karabiner-DriverKit-VirtualHIDDevice-X.X.X.pkg will be generated.

Notarize the package

Create App-Specific Passwords on .

  • name: pqrs.org notarization

Execute store-credentials

bash
xcrun notarytool store-credentials --apple-id [email protected] --team-id G43BCU2T37

Profile name:
> pqrs.org notarization

App-specific password for [email protected]:
> The password you created earlier

Then, notarize the package:

bash
make notarize

More detailed information

Components

Karabiner-DriverKit-VirtualHIDDevice consists the following components.

  • Extension Manager (including DriverKit driver)
    • /Applications/.Karabiner-VirtualHIDDevice-Manager.app
    • It provides a command line interface to activate or deactivate DriverKit driver.
  • Karabiner-VirtualHIDDevice-Daemon
    • /Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/Applications/Karabiner-VirtualHIDDevice-Daemon.app
    • It mediates between the client app and the driver.
    • It allows apps to communicate with the virtual device even if the app is not signed with pqrs.org's code signing identity. (The client app must be running with root privileges.)
  • Client apps
    • Client apps are not included in the distributed package.
    • For example, you can build the client app from examples/virtual-hid-device-service-client in this repository.
    • Client apps can send input events by communicating with Karabiner-VirtualHIDDevice-Daemon via UNIX domain socket. (/Library/Application Support/org.pqrs/tmp/rootonly/vhidd_server/*.sock)

Versions

Version is defined in version.json.

  • package_version:
    • Karabiner-DriverKit-VirtualHIDDevice package version.
    • Increment this when any components are updated.
  • driver_version:
    • DriverKit driver internal version.
    • Increment this when the driver source code is updated.
  • client_protocol_version:
    • The version for communication between Karabiner-VirtualHIDDevice-Daemon and the DriverKit driver.
    • Increment this when the communication specifications are changed.

Run Karabiner-VirtualHIDDevice-Daemon via launchd

Karabiner-VirtualHIDDevice-Daemon requires high responsiveness, so it is recommended to run it via launchd with the ProcessType: Interactive specified. There is an example application for registration with launchd in examples/SMAppServiceExample, which you can refer to for registering with launchd.

Extra documents

  • How to be close to DriverKit
  • Extracts from xnu

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++dextdriverkithidkeyboard

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言