# 使用 Homebrew, apt, dnf, MacPorts, Nix 安装 ydiff

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

## 安装

```sh
sudo av install brew:ydiff
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install ydiff
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install ydiff
```

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

### Linux

- Debian apt (92%):

```sh
sudo apt install python3-cdiff
```

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

- dnf (92%):

```sh
sudo dnf install python3-ydiff
```

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

  证据: nixpkgs package indexes: ydiff from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix

## 软件包事实

- **软件包键:** brew:ydiff
- **软件包管理器:** Homebrew
- **软件包管理器页面:** <https://formulae.brew.sh/formula/ydiff>
- **版本:** 1.5
- **来源摘要:** View colored diff with side by side and auto pager support
- **主页:** <https://github.com/ymattw/ydiff>
- **仓库:** <https://github.com/ymattw/ydiff>
- **上游文档:** <https://github.com/ymattw/ydiff#readme>
- **许可证:** BSD-3-Clause
- **源码归档:** <https://files.pythonhosted.org/packages/25/08/93b7e744645d94ae2f5dcddbbd2cfd5ec1420768994987a21a10b226be86/ydiff-1.5.tar.gz>
- **已生成:** 2026-07-08T18:08:21+00:00

## 可执行文件

- ydiff (cli)
- ydiff (别名)

## 依赖

- python@3.14

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 all

## 版本和新鲜度

- 页面生成时间: 2026-07-08
- 管理器版本: 1.5
- 本地数据: OK
- 上游仓库: https://github.com/ymattw/ydiff
- 信息: No package-manager update timestamp was available.
- 信息: No cached GitHub release or tag data was available.
## 项目历史与用法

Ydiff is a terminal diff viewer for colored, incremental diffs from version-control workspaces or stdin. It is best known for side-by-side display, automatic pager use, and a single-file Python implementation with no external Python dependencies.

### 项目历史

The GitHub repository was created on 2013-01-29, and the changelog begins with early PyPI-era releases in February 2013 under the original `cdiff` name. Within weeks it gained support for patch files, pipes, revision-control output, two-file comparison, color control, logs, and more robust diff parsing.

During 2013 and 2014, the project moved from a small colored-diff helper into a workspace-oriented reviewer: it added Git/SVN/Hg log handling, automatic terminal-width behavior, pager tuning, Python 3.4 support, and fixes for difficult unified diffs.

The 2018 1.1 release renamed the command from `cdiff` to `ydiff` to avoid a binary-name conflict on major distributions. Later releases added Perforce and Windows support, wide-character handling, word-level change blocks, default side-by-side behavior, and customizable themes.

### 采用历史

Ydiff adopted well for a small terminal tool because it solved a common packaging pain point: colorful side-by-side diffs without a GUI and without a heavy dependency stack. Its README documents installation from source, PyPI, Homebrew, Fedora, and FreeBSD.

Distribution adoption is visible in Homebrew, Fedora, FreeBSD/OpenBSD, Debian-derived package naming, and Nix-style package indexes. The rename from cdiff to ydiff is especially package-nerd relevant because it was driven by command-name collision management across distributions.

### 使用方式

Users run `ydiff` inside Git, Mercurial, Perforce, or Subversion workspaces to view current changes, staged Git changes via passed-through options such as `--cached`, or revision logs via `-l`. It can also consume `git show`, `git log -p`, `svn diff`, `diff -u`, directory diffs, and GitHub pull-request `.diff` URLs from stdin.

The practical attraction is that ydiff wraps ordinary unified diffs with readable terminal presentation: side-by-side or unified layout, automatic width detection, line wrapping controls, pager selection, themes, color modes, and safe redirection back to patch files.

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

Ydiff is a neat package-manager case study because almost all of its value ships as one Python command. Packaging it is mostly about naming, executable placement, and keeping terminal behavior consistent across Unix-like systems.

The cdiff-to-ydiff rename captures a real packaging concern: a project can be technically simple and still need an upstream identity change once distribution command namespaces collide.

### 时间线

- 2013-01-29: The ymattw/ydiff repository is created.
- 2013-02-04: Early PyPI-oriented changelog entries appear for cdiff.
- 2013-02-18: The changelog adds log-reading support for SVN and Mercurial patch logs.
- 2014-06-04: Python 3.4 support appears in the changelog.
- 2018-06-05: The project is renamed from cdiff to ydiff to avoid binary-name conflicts on major distributions.
- 2020-08-08: Perforce workspace and pager-customization support are added.
- 2024-11-13: Word-level change blocks and theme selection land in the 1.4 line.
- 2025-12-06: The changelog records INI-based custom themes and source/wheel publication changes.

### Related projects

- Related tools include cdiff, colordiff, diff, git diff, git show, git log -p, svn diff, hg log -p, Perforce diff tooling, icdiff, delta, diff-so-fancy, less, patchutils, and terminal pager workflows.

### 来源

- <https://api.github.com/repos/ymattw/ydiff>
- <https://formulae.brew.sh/formula/ydiff>
- <https://github.com/ymattw/ydiff>
- <https://github.com/ymattw/ydiff/issues/66>
- <https://packages.debian.org/sid/python3-ydiff>
- <https://pypi.org/project/ydiff/>
- <https://raw.githubusercontent.com/ymattw/ydiff/master/CHANGES.rst>
- <https://raw.githubusercontent.com/ymattw/ydiff/master/README.rst>


## 安全说明

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

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

- Debian apt - python3-cdiff - 1.4.2-1: normalized package name match | Debian stable package indexes: python3-cdiff from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Colored, incremental diff (transitional package)
- Debian apt - python3-ydiff - 1.4.2-1: normalized package name match | Debian stable package indexes: python3-ydiff from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Colored, incremental diff with side by side and auto pager support (Python 3)
- Nix - ydiff: normalized package name match | nixpkgs package indexes: ydiff from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix
- dnf - python3-ydiff - 1.5-8.fc45: normalized package name match | Fedora Rawhide package metadata: python3-ydiff from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | View colored, incremental diff | https://github.com/ymattw/ydiff
- dnf - ydiff - 1.5-8.fc45: normalized package name match | Fedora Rawhide package metadata: ydiff from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | View colored, incremental diff | https://github.com/ymattw/ydiff
- MacPorts - ydiff: normalized package name match | MacPorts ports tree: textproc/ydiff/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## 相关链接

- [Source-control packages](https://www.automicvault.com/zh-hans/pkg/source-control-tools/) - Belongs to a source-control command family.
- [Terminal utility packages](https://www.automicvault.com/zh-hans/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://www.automicvault.com/zh-hans/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://www.automicvault.com/zh-hans/pkg/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [python@3.14](https://www.automicvault.com/zh-hans/pkg/brew/python-3-14/) - Runtime dependency declared by Homebrew.
- [pkgdiff](https://www.automicvault.com/zh-hans/pkg/brew/pkgdiff/) - Shares av.db curated category or tags: cli, developer-tools, diff, diff-tools.
- [colordiff](https://www.automicvault.com/zh-hans/pkg/brew/colordiff/) - Shares av.db curated category or tags: cli, developer-tools, diff, terminal.
- [diff-so-fancy](https://www.automicvault.com/zh-hans/pkg/brew/diff-so-fancy/) - Shares av.db curated category or tags: cli, developer-tools, diff, terminal.
- [diffr](https://www.automicvault.com/zh-hans/pkg/brew/diffr/) - Shares av.db curated category or tags: cli, developer-tools, diff, terminal.
- [git-split-diffs](https://www.automicvault.com/zh-hans/pkg/brew/git-split-diffs/) - Shares av.db curated category or tags: cli, developer-tools, diff, terminal.
- [icdiff](https://www.automicvault.com/zh-hans/pkg/brew/icdiff/) - Shares av.db curated category or tags: cli, developer-tools, diff, terminal.
- [mdv](https://www.automicvault.com/zh-hans/pkg/brew/mdv/) - Shares av.db curated category or tags: cli, developer-tools, python, terminal.
- [percol](https://www.automicvault.com/zh-hans/pkg/brew/percol/) - Shares av.db curated category or tags: cli, developer-tools, python, terminal.
- [gptline](https://www.automicvault.com/zh-hans/pkg/brew/gptline/) - Both packages touch the same language runtime or ecosystem. Shared terms: cli, developer, developer-tools, python, python-3-14.

## Combined YAML source

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