# 使用 Homebrew, apk, dnf, MacPorts, Nix, zypper 安装 xmodmap

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

## 安装

```sh
sudo av install brew:xmodmap
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install xmodmap
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install xmodmap
```

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

### Linux

- apk (92%):

```sh
sudo apk add xmodmap
```

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

- dnf (92%):

```sh
sudo dnf install xmodmap
```

  证据: Fedora Rawhide package metadata: xmodmap 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#xmodmap
```

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

- zypper (92%):

```sh
sudo zypper install xmodmap
```

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

## 软件包事实

- **软件包键:** brew:xmodmap
- **软件包管理器:** Homebrew
- **版本:** 1.0.12
- **来源摘要:** Modify keymaps and pointer button mappings in X
- **主页:** <https://gitlab.freedesktop.org/xorg/app/xmodmap>
- **最后更新:** 2026-07-19T21:12:53Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- xmodmap (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

xmodmap is one of the old X11 session-shaping utilities: it edits and prints the keyboard modifier map, the keymap table used to translate keycodes into keysyms, and pointer button mappings. Its package-manager role is narrow but durable: install it when an X session needs per-user key remapping without changing a system keyboard layout.

### 项目历史

The X11R6.8.2 manual credits Jim Fulton of the MIT X Consortium, rewritten from an earlier version by David Rosenthal of Sun Microsystems, which places xmodmap squarely in the classic vendor-and-consortium X Window System toolset. The X.Org GitLab repository is the modern maintenance home for that small utility, describing it as a tool for modifying keymaps and pointer button mappings in X.

xmodmap persisted because X11 exposed keycodes, keysyms, modifier maps, and MappingNotify events as user-visible machinery. The utility is intentionally close to those primitives: it reads expressions such as keycode, keysym, add, remove, clear, and pointer assignments, parses them first, then applies the resulting map changes to the running X server.

### 采用历史

Historically, xmodmap became part of the personal Unix desktop toolkit. Its own manual says it is usually run from a user's session startup script, and the examples document common workstation-era irritations: swapping Caps Lock and Control, making Alt act as Meta, fixing Backspace/Delete behavior, adding less-than and greater-than bindings, and reversing pointer buttons for left-handed use.

Its adoption later became more situational as XKB, desktop-environment keyboard panels, libinput, Wayland compositors, and per-application shortcuts took over many layout tasks. Even so, package collections still carry xmodmap because remote X sessions, minimal window managers, old documentation, and quick one-line remaps still need the original X11-level tool.

### 使用方式

Typical usage is either ad hoc, such as xmodmap -e "pointer = 3 2 1", or startup-driven through a file such as ~/.xmodmaprc. Users inspect the current state with -pm, -pk, -pke, or -pp, then feed expressions back to the server to change modifier keys, keysyms, keycodes, or pointer buttons.

The main practical caveat is also in the old manual: mapping changes generate MappingNotify events, and clients that ignore those events may not notice changes. That is why xmodmap remains best suited to simple X11 session customization rather than full modern keyboard-layout management.

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

xmodmap is package archaeology that is still runnable. It is tiny, scriptable, X11-specific, and exposes the desktop stack at a level that newer settings panels hide. For package nerds, it is the difference between shipping an entire input-configuration layer and shipping one classic command that can still fix a weird keyboard in a minimal X session.

It also marks a useful boundary in platform history: when a package depends on xmodmap, it is probably assuming X11 semantics, not Wayland compositor settings or cross-platform shortcut APIs.

### 时间线

- X11 consortium era: xmodmap is authored by Jim Fulton of the MIT X Consortium, based on an earlier Sun Microsystems version by David Rosenthal.
- 1990s: X11R6-era documentation records xmodmap as a standard X utility for user startup scripts and key/pointer remapping.
- 2018-07-29: The freedesktop.org GitLab project for xorg/app/xmodmap is created as part of the modern X.Org source hosting layout.
- 2020s: xmodmap remains packaged mainly for X11 sessions, minimal desktops, remote X usage, and compatibility with old remapping recipes.

### Related projects

- xev is commonly used with xmodmap to discover keycodes and keysyms.
- XKB and setxkbmap cover broader X keyboard layout configuration that often supersedes xmodmap for full layouts.
- xinput, libinput, and compositor-specific settings cover much of the modern pointer/input space outside xmodmap's narrow X11 map-editing role.

### 来源

- <https://gitlab.freedesktop.org/xorg/app/xmodmap>
- <https://www.x.org/X11R6/>
- <https://xorg.freedesktop.org/archive/X11R6.8.2/doc/xmodmap.1.html>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals

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

- Nix - xmodmap: normalized package name match | nixpkgs package indexes: pkgs/by-name/xm/xmodmap/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- apk - xmodmap - 1.0.11-r1: normalized package name match | Alpine Linux edge package indexes: xmodmap from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Utility for modifying keymaps and pointer button mappings in X | https://xorg.freedesktop.org/
- apk - xmodmap-doc - 1.0.11-r1: normalized package name match | Alpine Linux edge package indexes: xmodmap-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Utility for modifying keymaps and pointer button mappings in X (documentation) | https://xorg.freedesktop.org/
- dnf - xmodmap - 1.0.12-4.fc45: normalized package name match | Fedora Rawhide package metadata: xmodmap from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Edit and display the X11 core keyboard map | https://www.x.org
- zypper - xmodmap - 1.0.12-1.2: normalized package name match | openSUSE Tumbleweed package metadata: xmodmap from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Utility to modify keymaps and pointer button mappings in X | https://xorg.freedesktop.org/
- MacPorts - xmodmap: normalized package name match | MacPorts ports tree: x11/xmodmap/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## Combined YAML source

View the package source record on GitHub. [combined/xmodmap.yml](https://github.com/mxcl/pkgdb/blob/main/combined/xmodmap.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
