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

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

## 安装

```sh
sudo av install brew:xsel
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install xsel
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install xsel
```

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

### Linux

- apk (92%):

```sh
sudo apk add xsel
```

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

- Debian apt (92%):

```sh
sudo apt install xsel
```

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

- dnf (92%):

```sh
sudo dnf install xsel
```

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

- Nix (92%):

```sh
nix profile install nixpkgs#xsel
```

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

- pacman (92%):

```sh
sudo pacman -S xsel
```

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

- zypper (92%):

```sh
sudo zypper install xsel
```

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

## 软件包事实

- **软件包键:** brew:xsel
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/xsel>
- **版本:** 1.2.1
- **来源摘要:** Command-line program for getting and setting the contents of the X selection
- **主页:** <https://www.vergenet.net/~conrad/software/xsel/>
- **仓库:** <https://github.com/kfish/xsel>
- **上游文档:** <https://www.vergenet.net/~conrad/software/xsel>
- **许可证:** HPND-sell-variant
- **源码归档:** <https://github.com/kfish/xsel/archive/refs/tags/1.2.1.tar.gz>
- **最后更新:** 2026-05-25T14:39:17-04:00
- **已生成:** 2026-07-08T18:08:21+00:00

## 可执行文件

- xsel (cli)
- xsel (别名)

## 依赖

- libx11

## 构建依赖

- autoconf
- automake
- libtool
- libxt
- pkgconf

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_big_sur, arm64_linux, arm64_monterey, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, big_sur, monterey, sonoma, ventura, x86_64_linux

## 版本和新鲜度

- 页面生成时间: 2026-07-08
- 管理器版本: 1.2.1
- 管理器更新时间: 2026-05-25
- 本地数据: OK
- 上游仓库: https://github.com/kfish/xsel
- 检测到的最新版本: 1.2.1 (当前)
## 项目历史与用法

xsel is Conrad Parker's command-line utility for reading and setting X selections. It turns PRIMARY, SECONDARY, and CLIPBOARD selection ownership into a pipe-friendly Unix interface, making X11 copy/paste state usable from shell scripts and terminal workflows.

### 项目历史

The xsel manpage identifies Conrad Parker as author and dates the program to July 2001, while the license file carries a 2001 copyright. Its homepage presents the core problem plainly: the X selection is normally accessible by manually highlighting text and pasting with the middle mouse button, while xsel lets files, pipes, and scripts participate.

The project developed around X11's ICCCM selection model. The manpage notes that there is no X selection buffer: xsel must own the selection and serve it on demand, often by forking a background process in input, keep, and exchange modes.

### 采用历史

xsel became a standard small X11 utility because it solved a daily terminal-desktop gap. The homepage says it is available in most distributions, and package metadata shows it in Homebrew, Alpine, Debian, Fedora, MacPorts, Nix, Arch, Ubuntu, and openSUSE ecosystems.

Its closest cultural sibling is `xclip`; both became staples in scripts that move text between command output, terminal multiplexers, editors, browsers, and the X clipboard. xsel's options for append, follow, keep, exchange, and secondary selection make it especially explicit about the underlying X selection machinery.

### 使用方式

Common usage is `command | xsel -b` to put text on the CLIPBOARD selection, `xsel -b -o` to print clipboard contents, `xsel < file` to own the PRIMARY selection with file contents, and `xsel > file` to save the current selection exactly.

The manpage documents PRIMARY as the default, with `--secondary` and `--clipboard` selecting the other X selections. Because X selection contents are served by the owner, xsel may detach in modes where it must keep supplying data after the shell command exits.

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

xsel is tiny, but it teaches a core X11 lesson: clipboard-like behavior is inter-client communication, not simply a global text buffer. Packaging it gives shell users a reliable bridge into that model.

It is also one of those utilities whose value increases in combinations: SSH sessions with X forwarding, terminal multiplexers, editors, scripts, password managers, build logs, and bug-report commands all benefit from being able to pipe text into or out of the X selection.

### 时间线

- 2001-07: The xsel manpage dates Conrad Parker's authorship to July 2001.
- 2001: The license file records Conrad Parker copyright for xsel.
- 2008-01: The distributed manpage is dated January 2008.
- 2009: The homepage lists version 1.2.0 as the latest available tarball.
- 2020s: xsel remains packaged across Linux, BSD, macOS package-manager, and X11 compatibility environments.

### Related projects

- xclip is the closest alternative command-line X clipboard/selection utility.
- xclipboard is the classic X clipboard manager referenced by the xsel manpage.
- ICCCM defines the X selection conventions xsel follows.
- Wayland-native clipboard tools such as wl-clipboard fill the equivalent niche outside X11.

### 来源

- <https://github.com/kfish/xsel>
- <https://linux.die.net/man/1/xsel>
- <https://raw.githubusercontent.com/kfish/xsel/master/COPYING>
- <https://raw.githubusercontent.com/kfish/xsel/master/xsel.1x>
- <https://www.vergenet.net/~conrad/software/xsel/>


## 安全说明

narrow executable package without higher-risk signals.

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

## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** xsel
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

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

- Debian apt - xsel - 1.2.1-1: normalized package name match | Debian stable package indexes: xsel from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | command-line tool to access X clipboard and selection buffers | http://www.vergenet.net/~conrad/software/xsel/
- Nix - xsel: normalized package name match | nixpkgs package indexes: pkgs/by-name/xs/xsel/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - xsel - 1.2.1-1: normalized package name match | Ubuntu 24.04 LTS package indexes: xsel from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | command-line tool to access X clipboard and selection buffers | http://www.vergenet.net/~conrad/software/xsel/
- apk - xsel - 1.2.1-r0: normalized package name match | Alpine Linux edge package indexes: xsel from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Command-line program for manipulating the X selection | http://www.vergenet.net/~conrad/software/xsel
- apk - xsel-doc - 1.2.1-r0: normalized package name match | Alpine Linux edge package indexes: xsel-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Command-line program for manipulating the X selection (documentation) | http://www.vergenet.net/~conrad/software/xsel
- dnf - xsel - 1.2.1-10.fc44: normalized package name match | Fedora Rawhide package metadata: xsel from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | Command line clipboard and X selection tool | https://www.vergenet.net/~conrad/software/xsel/
- pacman - xsel - 1.2.1-2: normalized package name match | Arch Linux sync databases: xsel from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Command-line program for getting and setting the contents of the X selection | https://vergenet.net/~conrad/software/xsel/
- zypper - xsel - 1.2.1-1.6: normalized package name match | openSUSE Tumbleweed package metadata: xsel from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Command-line Program for Getting and Setting the Contents of the X Selection | http://www.kfish.org/software/xsel/
- MacPorts - xsel: normalized package name match | MacPorts ports tree: x11/xsel/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## 相关链接

- [Terminal utility packages](https://www.automicvault.com/zh-hans/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Networking and protocol packages](https://www.automicvault.com/zh-hans/pkg/networking-protocol-tools/) - Matched network, protocol, or remote-service metadata.
- [Homebrew utility packages](https://www.automicvault.com/zh-hans/pkg/brew-utility-packages/) - Matched Homebrew package provider.
- [autoconf](https://www.automicvault.com/zh-hans/pkg/brew/autoconf/) - Build dependency declared by Homebrew.
- [automake](https://www.automicvault.com/zh-hans/pkg/brew/automake/) - Build dependency declared by Homebrew.
- [libtool](https://www.automicvault.com/zh-hans/pkg/brew/libtool/) - Build dependency declared by Homebrew.
- [yank](https://www.automicvault.com/zh-hans/pkg/brew/yank/) - Shares av.db curated category or tags: cli, clipboard, selection, system, terminal.
- [xclip](https://www.automicvault.com/zh-hans/pkg/brew/xclip/) - Shares av.db curated category or tags: cli, clipboard, system, x11.
- [libxcvt](https://www.automicvault.com/zh-hans/pkg/brew/libxcvt/) - Shares av.db curated category or tags: cli, system, x11.
- [libxpm](https://www.automicvault.com/zh-hans/pkg/brew/libxpm/) - Shares av.db curated category or tags: cli, system, x11.
- [mkfontscale](https://www.automicvault.com/zh-hans/pkg/brew/mkfontscale/) - Shares av.db curated category or tags: cli, system, x11.
- [xauth](https://www.automicvault.com/zh-hans/pkg/brew/xauth/) - Shares av.db curated category or tags: cli, system, x11.
- [xcursorgen](https://www.automicvault.com/zh-hans/pkg/brew/xcursorgen/) - Shares av.db curated category or tags: cli, system, x11.
- [xdpyinfo](https://www.automicvault.com/zh-hans/pkg/brew/xdpyinfo/) - Shares av.db curated category or tags: cli, system, x11.
- [xdotool](https://www.automicvault.com/zh-hans/pkg/brew/xdotool/) - Local package facts share a topical domain. Shared terms: cli, libx11, system, x11.

## Combined YAML source

View the package source record on GitHub. [combined/xsel.yml](https://github.com/automic-vault/db/blob/main/combined/xsel.yml)


## 来源

- Nucleus package database
- Geiger risk classifier
- package-page enrichment
- curated package history
- package version freshness
- av.db category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
