macOS
brew install unifdeflocal Homebrew formula metadata
sudo port install unifdefMacPorts ports tree · devel/unifdef/Portfile · source: api.github.com
brew / rank 9647
Selectively process conditional C preprocessor directives. Version 2.12 via Homebrew; verified from local package data. Also installable with debian: sudo apt install unifdef.
install
brew install unifdeflocal Homebrew formula metadata
sudo port install unifdefMacPorts ports tree · devel/unifdef/Portfile · source: api.github.com
sudo apk add unifdefAlpine Linux edge package indexes · unifdef · source: dl-cdn.alpinelinux.org
sudo apt install unifdefDebian stable package indexes · unifdef · source: deb.debian.org
sudo dnf install unifdefFedora Rawhide package metadata · unifdef · source: dl.fedoraproject.org
nix profile install nixpkgs#unifdefnixpkgs package indexes · pkgs/by-name/un/unifdef/package.nix · source: api.github.com
sudo pacman -S unifdefArch Linux sync databases · unifdef · source: geo.mirror.pkgbuild.com
sudo zypper install unifdefopenSUSE Tumbleweed package metadata · unifdef · source: download.opensuse.org
overview
Selectively process conditional C preprocessor directives
history
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.
security posture
No matching local secret-handling manifest was found for unifdef. Nucleus package metadata is still published here so future coverage has a stable package URL.
Before unattended agent use, check whether the tool reads plaintext credentials, writes remote state, publishes artifacts, or shells out to plugins.
executables
| Command | Kind | Exposure | Note |
|---|---|---|---|
unifdef | executable | indexed executable | Discovered from the local executable index. |
unifdefall | executable | indexed executable | Discovered from the local executable index. |
freshness
These signals separate page generation age, package-manager activity, and upstream release comparison. Version lag is warned only when an evidence URL and comparable versions are present.
install metadata
| Package key | brew:unifdef |
|---|---|
| Version | 2.12 |
| Package manager | Homebrew |
| Homepage | https://dotat.at/prog/unifdef/ |
| Repository | https://github.com/fanf2/unifdef |
| Bottle | not recorded |
| Service | none declared |
source database matches
Matches are pulled from external package-manager indexes and kept separate from local Automic Vault package links.
unifdef 2.12-1
Remove cpp '#ifdef' lines from files
sudo apt install unifdefunifdef
nix profile install nixpkgs#unifdefunifdef 2.12-1
Remove cpp '#ifdef' lines from files
sudo apt install unifdefunifdef 2.12-r4
Selectively remove C preprocessor conditionals
https://github.com/fanf2/unifdef
sudo apk add unifdefunifdef-doc 2.12-r4
Selectively remove C preprocessor conditionals (documentation)
https://github.com/fanf2/unifdef
sudo apk add unifdef-docunifdef 2.12-9.fc45
Selectively remove C preprocessor conditionals
https://dotat.at/prog/unifdef/
sudo dnf install unifdefunifdef 2.12-4
Remove #ifdef'ed lines
https://dotat.at/prog/unifdef/
sudo pacman -S unifdefunifdef 2.12-3.5
Removes ifdefs from C files
https://dotat.at/prog/unifdef/
sudo zypper install unifdefunifdef
sudo port install unifdefsource trail
This page is generated by av-web from the private package SQLite artifact built by scripts/generate-pkg-sqlite.py.
View the package source record on GitHub.