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

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

## 安装

```sh
sudo av install brew:xclip
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install xclip
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install xclip
```

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

### Linux

- apk (92%):

```sh
sudo apk add xclip
```

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

- Debian apt (92%):

```sh
sudo apt install xclip
```

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

- dnf (92%):

```sh
sudo dnf install xclip
```

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

- Nix (92%):

```sh
nix profile install nixpkgs#xclip
```

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

- pacman (92%):

```sh
sudo pacman -S xclip
```

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

- zypper (92%):

```sh
sudo zypper install xclip
```

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

## 软件包事实

- **软件包键:** brew:xclip
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/xclip>
- **版本:** 0.13
- **来源摘要:** Access X11 clipboards from the command-line
- **主页:** <https://github.com/astrand/xclip>
- **仓库:** <https://github.com/astrand/xclip>
- **许可证:** GPL-2.0-or-later
- **源码归档:** <https://github.com/astrand/xclip/archive/refs/tags/0.13.tar.gz>
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

- xclip (cli)
- xclip-copyfile (cli)
- xclip-cutfile (cli)
- xclip-pastefile (cli)
- xclip (别名)
- xclip-copyfile (别名)
- xclip-cutfile (别名)
- xclip-pastefile (别名)

## 依赖

- libx11
- libxmu

## 构建依赖

- autoconf
- automake

## 安装行为

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

## 版本和新鲜度

- 页面生成时间: 2026-08-04
- 管理器版本: 0.13
- 本地数据: OK
- 上游仓库: https://github.com/astrand/xclip
- 检测到的最新版本: 0.13 (当前)
- 信息: No package-manager update timestamp was available.
## 项目历史与用法

xclip is a long-running command-line interface to X11 selections. The README describes it as a utility for any system with an X11 implementation, able to read standard input or files into an X selection and print a selection back to standard output.

### 项目历史

The source file records copyright by Kim Saunders in 2001 and Peter Astrand in 2007-2008, marking xclip as an older Unix desktop utility that predates modern clipboard abstractions. Its old changelog starts at version 0.01, "Everything. First release, pretty basic, but it worked," then shows a steady evolution through file input, output mode, selection choice, INCR support for large transfers, UTF-8 fixes, man pages, and helper scripts.

Version 0.05 added the ability to access XA_SECONDARY and XA_CLIPBOARD rather than only the default primary selection. Version 0.06 added support for the X INCR mechanism, improving large-data transfers. Version 0.10 moved the build from Imake to Autoconf and added `xclip-copyfile` and `xclip-pastefile`, making the tool useful not only for text snippets but also for copying files over an existing X11 connection.

The project was historically hosted on SourceForge and later moved to GitHub. SourceForge now says the project remains there for historical reasons and points users to the GitHub repository; the GitHub changelog includes a February 2016 commit changing SourceForge URLs to GitHub. The 0.13 GitHub release in September 2016 gathered several years of fixes and small features after the 0.12 line.

### 采用历史

xclip became one of the standard small utilities installed when scripts, editors, or terminal workflows need access to the X11 clipboard. Debian describes it as a command-line interface to X selections, and distribution package pages across Debian, Fedora, Arch, Alpine, GNU Guix, OpenBSD ports, and Homebrew carry the same role: a tiny bridge between shell pipelines and desktop selection ownership.

Its adoption is also visible through how other software talks about clipboard support on Linux: command-line tools frequently recommend `xclip` or `xsel` for X11 clipboard integration. That position has persisted even as Wayland gained adoption, because X11 and XWayland sessions still expose the selection model that xclip was written to manipulate.

### 使用方式

The classic usage is pipeline-oriented: `uptime | xclip` puts command output into the primary selection, `xclip -o -sel clip` writes the clipboard to standard output, and `xclip -o | xclip -sel clip` copies the primary selection into the explicit clipboard. The README also documents use from Vim filters and scripts that open selected URLs or save browser-copied text.

The helper commands `xclip-copyfile`, `xclip-pastefile`, and `xclip-cutfile` use the selection mechanism to move files or directory trees between directories and even between machines when X11 forwarding is available. This is the package-nerd trick that makes xclip more than a text clipboard tool: it can piggyback on an already-authenticated X connection as a lightweight file-transfer path.

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

xclip matters because the X Window System has multiple selections, not just a single clipboard. The README points to the freedesktop.org clipboard specification and summarizes the difference between XA_PRIMARY, middle-click paste, and XA_CLIPBOARD, giving shell users precise control over a desktop feature that GUI applications usually hide.

The tool's design also explains a recurring Unix packaging pattern: a small C program, a man page, and shell helpers become the glue that lets unrelated programs interoperate. For headless or remote workflows it is still bounded by the existence of an X display, but within that boundary it remains the boring, reliable answer for "put this command output where my GUI can paste it."

### 时间线

- 2001: xclip source records Kim Saunders copyright, matching the earliest era of the project.
- 0.05: Adds `-selection` support for XA_SECONDARY and XA_CLIPBOARD.
- 0.06: Adds X INCR mechanism support for larger selection transfers.
- 0.10: Adds file-copy helper scripts and switches from Imake to Autoconf.
- 2010: Changelog records version 0.12 maintenance, man pages, and build fixes.
- 2016-02: Project URLs are changed from SourceForge to GitHub.
- 2016-09-13: GitHub release 0.13 collects several years of fixes and features.

### Related projects

- xsel is the other commonly cited X11 clipboard CLI and is often mentioned alongside xclip in Linux tooling.
- The freedesktop.org clipboard specification documents the X selection conventions that xclip exposes.

### 来源

- <https://github.com/astrand/xclip#readme>
- <https://github.com/astrand/xclip/blob/master/ChangeLog>
- <https://github.com/astrand/xclip/blob/master/xclip.c>
- <https://github.com/astrand/xclip/releases>
- <https://packages.debian.org/sid/xclip>
- <https://sourceforge.net/projects/xclip/>
- <https://specifications.freedesktop.org/clipboards-spec/clipboards-latest.txt>


## 安全说明

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:** xclip
- **Version Scheme:** 0
- **Revision:** 1
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** stable

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

- Debian apt - xclip - 0.13-4: normalized package name match | Debian stable package indexes: xclip from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | command line interface to X selections | https://github.com/astrand/xclip
- Nix - xclip: normalized package name match | nixpkgs package indexes: pkgs/by-name/xc/xclip/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - xclip - 0.13-3: normalized package name match | Ubuntu 24.04 LTS package indexes: xclip from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | command line interface to X selections | https://github.com/astrand/xclip
- apk - xclip - 0.13-r3: normalized package name match | Alpine Linux edge package indexes: xclip from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Command line interface to the X11 clipboard | https://github.com/astrand/xclip
- apk - xclip-doc - 0.13-r3: normalized package name match | Alpine Linux edge package indexes: xclip-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Command line interface to the X11 clipboard (documentation) | https://github.com/astrand/xclip
- dnf - xclip - 0.13-27.git11cba61.fc45: normalized package name match | Fedora Rawhide package metadata: xclip from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/210a2053c8e007daf9ae39c2a21daaed9b2ddd07d63ecffa597050361e73650c-primary.xml.zst | Command line clipboard grabber | http://sourceforge.net/projects/xclip
- pacman - xclip - 0.13-6: normalized package name match | Arch Linux sync databases: xclip from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Command line interface to the X11 clipboard | https://github.com/astrand/xclip
- zypper - xclip - 0.13+git20220129-1.7: normalized package name match | openSUSE Tumbleweed package metadata: xclip from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Command Line Interface to the X11 Clipboard | https://github.com/astrand/xclip
- MacPorts - xclip: normalized package name match | MacPorts ports tree: x11/xclip/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## 相关链接

- [Source-control packages](https://pkg.so/zh-hans/source-control-tools/) - Belongs to a source-control command family.
- [Terminal utility packages](https://pkg.so/zh-hans/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Networking and protocol packages](https://pkg.so/zh-hans/networking-protocol-tools/) - Matched network, protocol, or remote-service metadata.
- [Homebrew utility packages](https://pkg.so/zh-hans/brew-utility-packages/) - Matched Homebrew package provider.
- [autoconf](https://pkg.so/zh-hans/brew/autoconf/) - Build dependency declared by Homebrew.
- [automake](https://pkg.so/zh-hans/brew/automake/) - Build dependency declared by Homebrew.
- [tmpmail](https://pkg.so/zh-hans/brew/tmpmail/) - Popular package that depends on this formula.
- [xsel](https://pkg.so/zh-hans/brew/xsel/) - Shares pkgdb curated category or tags: cli, clipboard, system, x11.
- [openmotif](https://pkg.so/zh-hans/brew/openmotif/) - Shares pkgdb curated category or tags: cli, system, unix, x11.
- [yank](https://pkg.so/zh-hans/brew/yank/) - Shares pkgdb curated category or tags: cli, clipboard, system, unix.
- [bash](https://pkg.so/zh-hans/brew/bash/) - Shares pkgdb curated category or tags: cli, system, unix.
- [gnu-tar](https://pkg.so/zh-hans/brew/gnu-tar/) - Shares pkgdb curated category or tags: cli, system, unix.
- [cups](https://pkg.so/zh-hans/brew/cups/) - Shares pkgdb curated category or tags: cli, system, unix.
- [watch](https://pkg.so/zh-hans/brew/watch/) - Shares pkgdb curated category or tags: cli, system, system-utility.
- [libxkbcommon](https://pkg.so/zh-hans/brew/libxkbcommon/) - Shares pkgdb curated category or tags: cli, system, x11.
- [brightness](https://pkg.so/zh-hans/brew/brightness/) - Local package facts share a topical domain. Shared terms: cli, command-line, line, system, system-utility.
- [mist-cli](https://pkg.so/zh-hans/brew/mist-cli/) - Local package facts share a topical domain. Shared terms: cli, command-line, line, system, system-utility.
- [nq](https://pkg.so/zh-hans/brew/nq/) - Local package facts share a topical domain. Shared terms: cli, command-line, line, system, unix.

## Combined YAML source

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


## 来源

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