# Install m4 with Homebrew, apk, apt, dnf, MacPorts, Nix, pacman, scoop, zypper

Macro processing language. Version 1.4.21 via Homebrew; verified from local package data.

## Install

```sh
sudo av install brew:m4
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install m4
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install m4
```

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

### Linux

- apk (92%):

```sh
sudo apk add m4
```

  Evidence: Alpine Linux edge package indexes: m4 from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install m4
```

  Evidence: Debian stable package indexes: m4 from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install m4
```

  Evidence: Fedora Rawhide package metadata: m4 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#m4
```

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

- pacman (92%):

```sh
sudo pacman -S m4
```

  Evidence: Arch Linux sync databases: m4 from https://geo.mirror.pkgbuild.com/core/os/x86_64/core.db.tar.gz

- zypper (92%):

```sh
sudo zypper install m4
```

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

### Windows

- Scoop (92%):

```sh
scoop install main/m4
```

  Evidence: Scoop official bucket manifest trees: bucket/m4.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

## Package facts

- **Package key:** brew:m4
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/m4>
- **Version:** 1.4.21
- **Source summary:** Macro processing language
- **Homepage:** <https://www.gnu.org/software/m4/>
- **Repository:** <https://git.savannah.gnu.org/r/m4.git>
- **Upstream docs:** <https://www.gnu.org/software/m4/manual>
- **License:** GPL-3.0-or-later
- **Source archive:** <https://ftpmirror.gnu.org/gnu/m4/m4-1.4.21.tar.xz>
- **Generated:** 2026-07-08T07:18:31+00:00

## Executables

- m4 (cli)
- m4 (alias)

## Install behavior

- Post-install hook: not defined
- Bottle: available on arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sequoia, sonoma, tahoe, x86_64_linux

## Freshness

- Page generated: 2026-07-08
- Package-manager version: 1.4.21
- Local data: ok
- Upstream repository: https://www.gnu.org/software/m4/
- info: No package-manager update timestamp was available.
- info: Release/tag comparison is only available for GitHub repositories.
## Project history and usage

GNU M4 is the GNU implementation of the traditional Unix `m4` macro processor. It expands built-in and user-defined macros while copying input to output and is used both directly and as infrastructure for other build tools.

### Project history

The m4 lineage is older than GNU: the GNU manual traces macro-language ideas to 1950s and 1960s work by Alan Perlis, Doug McIlroy, Christopher Strachey, and Bell Labs macro processors such as GPM and M6.

Kernighan and Ritchie developed the original `m4` at Bell Labs in 1977. GNU M4 was released by Rene Seindal in 1990 to remove artificial limits in many traditional implementations, including line length, macro size, and macro-count limits.

Francois Pinard maintained GNU M4 in the early 1990s and released version 1.4 in 1994. After a long stable period, maintenance resumed with Paul Eggert, Gary V. Vaughan, Eric Blake, and later releases in the 1.4 series through 1.4.20.

### Adoption history

The GNU manual notes that `m4` is widely available on Unix systems and standardized by POSIX. Many users install GNU M4 indirectly because GNU Autoconf requires it to generate configure scripts.

The supplied package-manager facts show the package across Homebrew, Debian, Ubuntu, Fedora, Arch, Alpine, Nix, MacPorts, Scoop, and openSUSE, which matches its role as a baseline development dependency.

### How it is used

GNU M4 can be invoked as `m4 [option...] [file...]`. It supports macro expansion, file inclusion, shell-command execution, arithmetic, text manipulation, and recursion.

In package builds, direct human-written M4 macros are less common than Autoconf usage, but maintainers still care about GNU M4 compatibility because configure-generation failures often trace back to macro behavior.

### Why package nerds care

GNU M4 is one of the quiet pieces of the Autotools stack: many source packages do not need it at runtime, but build-from-VCS workflows and autoreconf pipelines often need the GNU implementation.

It matters to package maintainers because POSIX `m4`, vendor `m4`, and GNU M4 have historically differed in limits and extensions, and Autoconf intentionally standardized on GNU M4 to avoid those limitations.

### Timeline

- 1977: Original Bell Labs m4 described by Kernighan and Ritchie
- 1990: Rene Seindal released GNU M4
- 1994: GNU M4 1.4 released as a long-lived stable version
- 2004: 1.4.1 and 1.4.2 addressed long-standing bugs
- 2025: GNU M4 1.4.20 released

### Related projects

- GNU Autoconf is one of GNU M4's biggest users and requires GNU M4 as its macro engine.
- Traditional Unix m4 implementations, GPM, M6, M5, and Ratfor-related preprocessors are part of the historical macro-processor lineage.

### Sources

- <https://www.gnu.org/software/m4/>
- <https://www.gnu.org/software/m4/manual/>
- <https://www.gnu.org/software/m4/manual/html_node/History.html>
- <https://www.gnu.org/software/m4/manual/html_node/Intro.html>
- source_facts.package-manager


## Security Notes

narrow executable package without higher-risk signals.

- **Geiger risk:** green / low
- narrow executable package without higher-risk signals

## Source Database Details

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

## Other Package-Manager Records

- Debian apt - m4 - 1.4.19-8: normalized package name match | Debian stable package indexes: m4 from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | macro processing language | https://www.gnu.org/software/m4/
- Debian apt - m4-doc - 1.4.19-8: normalized package name match | Debian stable package indexes: m4-doc from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Documentation for GNU m4 | https://www.gnu.org/software/m4/
- Nix - m4: normalized package name match | nixpkgs package indexes: m4 from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix
- Ubuntu apt - m4 - 1.4.19-4build1: normalized package name match | Ubuntu 24.04 LTS package indexes: m4 from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | macro processing language | https://www.gnu.org/software/m4/
- Ubuntu apt - m4-doc - 1.4.19-4build1: normalized package name match | Ubuntu 24.04 LTS package indexes: m4-doc from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | Documentation for GNU m4 | https://www.gnu.org/software/m4/
- apk - m4 - 1.4.20-r1: normalized package name match | Alpine Linux edge package indexes: m4 from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | GNU macro processor | https://www.gnu.org/software/m4
- apk - m4-doc - 1.4.20-r1: normalized package name match | Alpine Linux edge package indexes: m4-doc from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | GNU macro processor (documentation) | https://www.gnu.org/software/m4
- dnf - m4 - 1.4.21-1.fc45: normalized package name match | Fedora Rawhide package metadata: m4 from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | GNU macro processor | https://www.gnu.org/software/m4/
- pacman - m4 - 1.4.21-2: normalized package name match | Arch Linux sync databases: m4 from https://geo.mirror.pkgbuild.com/core/os/x86_64/core.db.tar.gz | The GNU macro processor | https://www.gnu.org/software/m4
- zypper - m4 - 1.4.21-1.2: normalized package name match | openSUSE Tumbleweed package metadata: m4 from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | GNU m4 | https://www.gnu.org/software/m4/
- MacPorts - m4: normalized package name match | MacPorts ports tree: devel/m4/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Scoop - main/m4: normalized package name match | Scoop official bucket manifest trees: bucket/m4.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1


## Related links

- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://www.automicvault.com/pkg/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://www.automicvault.com/pkg/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [Language runtime packages](https://www.automicvault.com/pkg/language-runtime-packages/) - Matched language runtime, compiler, or interpreter metadata.
- [autoconf](https://www.automicvault.com/pkg/brew/autoconf/) - Popular package that depends on this formula.
- [crosstool-ng](https://www.automicvault.com/pkg/brew/crosstool-ng/) - Popular package that depends on this formula.
- [libtool](https://www.automicvault.com/pkg/brew/libtool/) - Popular package that depends on this formula.
- [m-cli](https://www.automicvault.com/pkg/brew/m-cli/) - Package name indicates the same formula family.
- [diffutils](https://www.automicvault.com/pkg/brew/diffutils/) - Shares av.db curated category or tags: cli, developer-tools, gnu, text-processing.
- [enscript](https://www.automicvault.com/pkg/brew/enscript/) - Shares av.db curated category or tags: cli, developer-tools, gnu, text-processing.
- [gawk](https://www.automicvault.com/pkg/brew/gawk/) - Shares av.db curated category or tags: cli, developer-tools, gnu, text-processing.
- [grep](https://www.automicvault.com/pkg/brew/grep/) - Shares av.db curated category or tags: cli, developer-tools, gnu, text-processing.
- [wdiff](https://www.automicvault.com/pkg/brew/wdiff/) - Shares av.db curated category or tags: cli, developer-tools, gnu, text-processing.
- [align](https://www.automicvault.com/pkg/brew/align/) - Shares av.db curated category or tags: cli, developer-tools, text-processing.
- [angle-grinder](https://www.automicvault.com/pkg/brew/angle-grinder/) - Shares av.db curated category or tags: cli, developer-tools, text-processing.
- [arm-linux-gnueabihf-binutils](https://www.automicvault.com/pkg/brew/arm-linux-gnueabihf-binutils/) - Shares av.db curated category or tags: cli, developer-tools, gnu.

## Combined YAML source

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


## Sources

- 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
