# unifdef を Homebrew, apk, apt, dnf, MacPorts, Nix, pacman, zypper でインストール

unifdef のインストール経路、実行ファイル、メタデータ、AI エージェント向けセキュリティノートを確認します。

## インストール

```sh
sudo av install brew:unifdef
```

追加のインストールコマンド:

### macOS

- Homebrew (100%):

```sh
brew install unifdef
```

  証拠: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install unifdef
```

  証拠: MacPorts ports tree: devel/unifdef/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add unifdef
```

  証拠: Alpine Linux edge package indexes: unifdef from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install unifdef
```

  証拠: Debian stable package indexes: unifdef from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install unifdef
```

  証拠: Fedora Rawhide package metadata: unifdef 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#unifdef
```

  証拠: nixpkgs package indexes: pkgs/by-name/un/unifdef/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S unifdef
```

  証拠: Arch Linux sync databases: unifdef from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install unifdef
```

  証拠: openSUSE Tumbleweed package metadata: unifdef from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

## パッケージ情報

- **パッケージキー:** brew:unifdef
- **パッケージマネージャ:** Homebrew
- **パッケージマネージャページ:** <https://formulae.brew.sh/formula/unifdef>
- **バージョン:** 2.12
- **ソース概要:** Selectively process conditional C preprocessor directives
- **ホームページ:** <https://dotat.at/prog/unifdef/>
- **リポジトリ:** <https://github.com/fanf2/unifdef>
- **上流ドキュメント:** <https://dotat.at/prog/unifdef/>
- **ライセンス:** BSD-2-Clause AND BSD-3-Clause
- **ソースアーカイブ:** <https://dotat.at/prog/unifdef/unifdef-2.12.tar.gz>
- **生成日時:** 2026-08-04T22:13:35+00:00

## 実行可能ファイル

- unifdef (cli)
- unifdefall (cli)
- unifdef (エイリアス)
- unifdefall (エイリアス)

## インストール挙動

- 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
- マネージャ版: 2.12
- ローカルデータ: OK
- 上流リポジトリ: https://dotat.at/prog/unifdef/
- 情報: No package-manager update timestamp was available.
- 情報: Release/tag comparison is only available for GitHub repositories.
## プロジェクトの歴史と使われ方

unifdef is a source-filtering utility that selectively removes C preprocessor conditionals. The official manual says it processes `#if`, `#ifdef`, `#ifndef`, `#elif`, `#else`, and `#endif` lines when command-line macro definitions are sufficient to decide whether a block should be kept or removed.

### プロジェクトの歴史

unifdef is much older than its GitHub mirror. The official manual states that the command appeared in 2.9BSD, and that ANSI C support was added in FreeBSD 4.7. It also credits the original implementation to Dave Yost and Tony Finch's rewrite for ANSI C support.

Tony Finch's official project page explains the modern motivation: understanding `xterm`'s heavily conditionalized pty-handling code. That places unifdef in the Unix source-reading and source-cleanup tradition rather than in general-purpose preprocessing.

The current project page publishes release archives, manual documentation, a browsable source repository, and a GitHub collaboration mirror. The GitHub README warns that GitHub release downloads are incomplete and points users back to the official dotat.at release files, which is useful context for packagers.

### 採用の歴史

The official homepage gives a concrete high-profile adoption example: the Linux kernel uses unifdef to strip `#ifdef __KERNEL__` sections from headers exported to userland. It also notes use outside C, including LaTeX workflows.

The supplied package facts show broad distribution packaging across Homebrew, Debian/Ubuntu, Fedora/DNF, Alpine, Arch, MacPorts, Nix, openSUSE, and others. That matches the tool's age and purpose: it is small, portable, and useful in build and source-export pipelines.

### 使われ方

unifdef is used by specifying macros with `-D`, `-U`, or a definitions file, then filtering input files so known conditional branches are removed while unknown conditionals are preserved. It can operate on stdin/stdout or modify files in place.

The manual also documents `unifdefall`, a script that uses `unifdef -s` and `cpp -dM` to derive macro information and remove all conditional directives from a file. This shows the tool's role as a controlled partial preprocessor rather than a full C preprocessor replacement.

### パッケージ好きにとっての重要性

unifdef is important in the package-nerd niche because it is both tiny and historically deep: a BSD-era tool still used for practical source filtering. It belongs in base-system and package-manager collections because build scripts and source-export tasks can depend on it without pulling in a large toolchain beyond normal C build support.

Its Linux-kernel header-export use case is exactly the kind of quiet infrastructure job package maintainers care about: remove implementation-only conditional sections, preserve line-oriented source structure, and keep generated user-facing source understandable.

### タイムライン

- 2.9BSD: Manual says the `unifdef` command appeared.
- FreeBSD 4.7: Manual says ANSI C support was added.
- 2015: Official manual page is dated December 3, 2015.
- Current project page: Release 2.12 archives are published on dotat.at.
- Current README: GitHub is maintained as a collaboration mirror, while release downloads remain on dotat.at.

### Related projects

- The manual lists `cpp(1)` and `diff(1)` as related tools.
- The official page cites Linux kernel header export as a real-world use.
- The official page also mentions use with LaTeX, showing text-mode uses outside C.

### ソース

- <https://dotat.at/prog/unifdef/>
- <https://dotat.at/prog/unifdef/unifdef.txt>
- <https://github.com/fanf2/unifdef#readme>
- input.source_facts.package-manager


## セキュリティノート

unifdef に一致するローカルシークレット処理マニフェストは見つかりませんでした。将来の対応で安定したパッケージ URL を使えるよう、パッケージメタデータはここに公開されています。


## ソースデータベース詳細

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

## 他のパッケージマネージャ記録

- Debian apt - unifdef - 2.12-1: normalized package name match | Debian stable package indexes: unifdef from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Remove cpp '#ifdef' lines from files | http://dotat.at/prog/unifdef/
- Nix - unifdef: normalized package name match | nixpkgs package indexes: pkgs/by-name/un/unifdef/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - unifdef - 2.12-1: normalized package name match | Ubuntu 24.04 LTS package indexes: unifdef from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Remove cpp '#ifdef' lines from files | http://dotat.at/prog/unifdef/
- apk - unifdef - 2.12-r4: normalized package name match | Alpine Linux edge package indexes: unifdef from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Selectively remove C preprocessor conditionals | https://github.com/fanf2/unifdef
- apk - unifdef-doc - 2.12-r4: normalized package name match | Alpine Linux edge package indexes: unifdef-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Selectively remove C preprocessor conditionals (documentation) | https://github.com/fanf2/unifdef
- dnf - unifdef - 2.12-9.fc45: normalized package name match | Fedora Rawhide package metadata: unifdef from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/210a2053c8e007daf9ae39c2a21daaed9b2ddd07d63ecffa597050361e73650c-primary.xml.zst | Selectively remove C preprocessor conditionals | https://dotat.at/prog/unifdef/
- pacman - unifdef - 2.12-4: normalized package name match | Arch Linux sync databases: unifdef from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Remove #ifdef'ed lines | https://dotat.at/prog/unifdef/
- zypper - unifdef - 2.12-3.5: normalized package name match | openSUSE Tumbleweed package metadata: unifdef from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Removes ifdefs from C files | https://dotat.at/prog/unifdef/
- MacPorts - unifdef: normalized package name match | MacPorts ports tree: devel/unifdef/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## 関連リンク

- [Terminal utility packages](https://pkg.so/ja/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://pkg.so/ja/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://pkg.so/ja/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [Networking and protocol packages](https://pkg.so/ja/networking-protocol-tools/) - Matched network, protocol, or remote-service metadata.
- [cppi](https://pkg.so/ja/brew/cppi/) - Shares pkgdb curated category or tags: c-preprocessor, cli, developer-tools.
- [tradcpp](https://pkg.so/ja/brew/tradcpp/) - Shares pkgdb curated category or tags: c-preprocessor, cli, developer-tools.
- [dpp](https://pkg.so/ja/brew/dpp/) - Local package facts share a topical domain. Shared terms: cli, developer, developer-tools, preprocessor, source.
- [fourmolu](https://pkg.so/ja/brew/fourmolu/) - Local package facts share a topical domain. Shared terms: cli, developer, developer-tools, source.
- [patchutils](https://pkg.so/ja/brew/patchutils/) - Local package facts share a topical domain. Shared terms: cli, developer, developer-tools, source.

## Combined YAML source

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


## ソース

- pkg.so package database
- 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
