# 使用 Homebrew, apk, dnf, MacPorts, Nix, pacman, apt, zypper 安装 hidapi

查看 hidapi 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:hidapi
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install hidapi
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install hidapi
```

  证据: MacPorts ports tree: comms/hidapi/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add hidapi
```

  证据: Alpine Linux edge package indexes: hidapi from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- dnf (92%):

```sh
sudo dnf install hidapi
```

  证据: Fedora Rawhide package metadata: hidapi from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#hidapi
```

  证据: nixpkgs package indexes: pkgs/by-name/hi/hidapi/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S hidapi
```

  证据: Arch Linux sync databases: hidapi from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- Debian apt (92%):

```sh
sudo apt install libhidapi-dev
```

  证据: Debian stable package indexes: libhidapi-dev from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- zypper (92%):

```sh
sudo zypper install libhidapi-devel
```

  证据: openSUSE Tumbleweed package metadata: libhidapi-devel from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

## 软件包事实

- **软件包键:** brew:hidapi
- **软件包管理器:** Homebrew
- **版本:** 0.15.0
- **来源摘要:** Library for communicating with USB and Bluetooth HID devices
- **主页:** <https://libusb.info/hidapi/>
- **仓库:** <https://github.com/libusb/hidapi>
- **最后更新:** 2026-06-15T10:20:18-04:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- hidtest_hidraw (别名)
- hidtest_libusb (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 0.15.0
## 项目历史与用法

HIDAPI is a small C library for talking to USB and Bluetooth HID-class devices across Windows, Linux, FreeBSD, and macOS. Its package-manager identity is both a development library and a pair of small test binaries used to verify HID access.

The project is valued because it hides the platform split between Windows `hid.dll`, macOS IOHidManager, Linux hidraw, and libusb-backed Unix builds behind one C API.

### 项目历史

HIDAPI was originally developed by Alan Ott of Signal 11 Software; the original license file carries a 2009 copyright notice. The tag history shows public 0.x releases beginning in 2010, with early work around test programs and platform makefiles.

The README records a major stewardship change on June 4, 2019, when the project moved to `libusb/hidapi` to merge important bug fixes and continue development. Release tags after that move include 0.9.0 in June 2019 and later work on CMake, Meson wrapping, API additions, and backend fixes.

The library kept its simple integration model across the move: applications can link a shared library or embed one platform-specific source file plus the public header. That made HIDAPI practical for hardware tools that need a low-friction C dependency.

### 采用历史

HIDAPI is widely packaged because it solves a cross-platform hardware problem at the C ABI level. The input package map lists packages for Alpine, Homebrew, Debian/Ubuntu, Fedora, MacPorts, Nix, Arch, and openSUSE-style systems.

The libusb-hosted repository also matters socially: libusb is a familiar home for USB users, and the README says the Linux/libusb backend uses libusb-1.0 while Linux/hidraw supports both USB and Bluetooth HID devices.

### 使用方式

Typical application usage is to initialize the library, open a device by vendor ID and product ID, exchange input/output/feature reports, and close/finalize the handle. The README includes a compact C example and points developers to `hidtest/test.c` as a starting point.

On Linux, users choose between `libhidapi-hidraw` and `libhidapi-libusb` at link time, with udev rules needed for unprivileged device access. On macOS and Windows, HIDAPI uses the native HID frameworks exposed by the operating system.

### 为什么软件包爱好者会关心

HIDAPI is a classic package-manager library: small, C ABI-friendly, cross-platform, and pulled into many higher-level device tools. It earns its slot in package sets because every downstream would rather not reinvent HID enumeration and report I/O per OS.

Its licensing is also package-relevant. The README and license files describe GPL-3.0, BSD-style, and original HIDAPI license options, letting open-source and closed-source consumers pick an appropriate licensing path.

### 时间线

- 2009: Original HIDAPI license text credits Alan Ott and Signal 11 Software.
- 2010: hidapi-0.1.0 tag starts the public release line.
- 2019: Project moves to libusb/hidapi for continued maintenance.
- 2019: hidapi-0.9.0 is released after the libusb stewardship move.
- 2023: hidapi-0.13.0 adds device-info API work and Meson wrapper support.
- 2025: hidapi-0.15.0 adds more report/error API surface.

### Related projects

- libusb is both a related project and one of HIDAPI's Unix backends.
- hidraw is the Linux kernel interface used by HIDAPI's Linux/hidraw backend.
- hidapitester is a console test application recommended by the README for trying HID devices before integrating HIDAPI into an application.

### 来源

- Build documentation: https://github.com/libusb/hidapi/blob/master/BUILD.md
- License files: https://github.com/libusb/hidapi/blob/master/LICENSE.txt
- Public API header: https://github.com/libusb/hidapi/blob/master/hidapi/hidapi.h
- README: https://github.com/libusb/hidapi#readme
- Repository tags: https://github.com/libusb/hidapi/tags


## 安全说明

library-like package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- library-like package without higher-risk signals

## 其他软件包管理器记录

- Debian apt - libhidapi-dev - 0.14.0-1+b2: normalized package name match | Debian stable package indexes: libhidapi-dev from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Multi-Platform library for communication with HID devices (development files) | https://github.com/libusb/hidapi
- Debian apt - libhidapi-hidraw0 - 0.14.0-1+b2: normalized package name match | Debian stable package indexes: libhidapi-hidraw0 from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Multi-Platform library for communication with HID devices (hidraw backend) | https://github.com/libusb/hidapi
- Debian apt - libhidapi-libusb0 - 0.14.0-1+b2: normalized package name match | Debian stable package indexes: libhidapi-libusb0 from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Multi-Platform library for communication with HID devices (libusb backend) | https://github.com/libusb/hidapi
- Nix - hidapi: normalized package name match | nixpkgs package indexes: pkgs/by-name/hi/hidapi/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - libhidapi-dev - 0.14.0-1build1: normalized package name match | Ubuntu 24.04 LTS package indexes: libhidapi-dev from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Multi-Platform library for communication with HID devices (development files) | https://github.com/libusb/hidapi
- Ubuntu apt - libhidapi-hidraw0 - 0.14.0-1build1: normalized package name match | Ubuntu 24.04 LTS package indexes: libhidapi-hidraw0 from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Multi-Platform library for communication with HID devices (hidraw backend) | https://github.com/libusb/hidapi
- Ubuntu apt - libhidapi-libusb0 - 0.14.0-1build1: normalized package name match | Ubuntu 24.04 LTS package indexes: libhidapi-libusb0 from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Multi-Platform library for communication with HID devices (libusb backend) | https://github.com/libusb/hidapi
- apk - hidapi - 0.15.0-r0: normalized package name match | Alpine Linux edge package indexes: hidapi from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Simple library for communicating with USB and Bluetooth HID devices | https://github.com/libusb/hidapi
- apk - hidapi-dev - 0.15.0-r0: normalized package name match | Alpine Linux edge package indexes: hidapi-dev from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Simple library for communicating with USB and Bluetooth HID devices (development files) | https://github.com/libusb/hidapi
- dnf - hidapi - 0.15.0-4.fc45: normalized package name match | Fedora Rawhide package metadata: hidapi from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Library for communicating with USB and Bluetooth HID devices | https://github.com/libusb/hidapi
- dnf - hidapi-devel - 0.15.0-4.fc45: normalized package name match | Fedora Rawhide package metadata: hidapi-devel from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Development files for hidapi | https://github.com/libusb/hidapi
- dnf - mingw32-hidapi - 0.15.0-4.fc45: normalized package name match | Fedora Rawhide package metadata: mingw32-hidapi from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Development files for hidapi | https://github.com/libusb/hidapi
- dnf - mingw64-hidapi - 0.15.0-4.fc45: normalized package name match | Fedora Rawhide package metadata: mingw64-hidapi from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Development files for hidapi | https://github.com/libusb/hidapi
- pacman - hidapi - 0.15.0-1: normalized package name match | Arch Linux sync databases: hidapi from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Simple library for communicating with USB and Bluetooth HID devices | https://github.com/libusb/hidapi
- zypper - libhidapi-devel - 0.14.0-1.9: normalized package name match | openSUSE Tumbleweed package metadata: libhidapi-devel from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Development libraries and header files for hidapi | https://github.com/libusb/hidapi
- zypper - libhidapi-hidraw0 - 0.14.0-1.9: normalized package name match | openSUSE Tumbleweed package metadata: libhidapi-hidraw0 from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Simple library for communicating with USB and Bluetooth HID devices | https://github.com/libusb/hidapi


## Combined YAML source

View the package source record on GitHub. [combined/hidapi.yml](https://github.com/mxcl/pkgdb/blob/main/combined/hidapi.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
