# Install gpatch with Homebrew, MacPorts, apk, chocolatey, apt, dnf, Nix, pacman, scoop, winget, zypper

Apply a diff file to an original. Version 2.8 via Homebrew; verified from local package data.

## Install

```sh
sudo av install brew:gpatch
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install gpatch
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install gpatch
```

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

### Linux

- apk (92%):

```sh
sudo apk add patch
```

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

- Debian apt (92%):

```sh
sudo apt install patch
```

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

- dnf (92%):

```sh
sudo dnf install patch
```

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

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

- pacman (92%):

```sh
sudo pacman -S patch
```

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

- zypper (92%):

```sh
sudo zypper install patch
```

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

### Windows

- Chocolatey (92%):

```sh
choco install patch
```

  Evidence: Chocolatey community package catalog: patch from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','openssh'

- Scoop (92%):

```sh
scoop install main/patch
```

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

- winget (92%):

```sh
winget install --id GnuWin32.Patch -e
```

  Evidence: Windows Package Manager source index: GnuWin32.Patch from https://cdn.winget.microsoft.com/cache/source.msix

## Package facts

- **Package key:** brew:gpatch
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/gpatch>
- **Version:** 2.8
- **Source summary:** Apply a diff file to an original
- **Homepage:** <https://savannah.gnu.org/projects/patch/>
- **Repository:** <https://git.savannah.gnu.org/cgit/patch.git>
- **Upstream docs:** <https://savannah.gnu.org/projects/patch>
- **License:** GPL-3.0-or-later
- **Source archive:** <https://ftpmirror.gnu.org/gnu/patch/patch-2.8.tar.xz>
- **Generated:** 2026-07-08T07:18:31+00:00

## Executables

- patch (cli)
- patch (alias)

## Install behavior

- Post-install hook: not defined
- Caveats: GNU "patch" has been installed as "gpatch". If you need to use it as "patch", you can add a "gnubin" directory to your PATH from your bashrc like: PATH="$HOMEBREW_PREFIX/opt/gpatch/libexec/gnubin:$PATH"
- Bottle: available on arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, sonoma, ventura, x86_64_linux

## Freshness

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

GNU patch applies diff output to original files to produce modified files. It descends from Larry Wall's patch program and became one of the basic tools of Unix source distribution, mailing-list development, and package-manager patch application.

### Project history

The GNU patch README states that this GNU version applies diff files to original files and includes many Free Software Foundation changes: binary and large-file handling, unified diff support, merge behavior, GNU-style backup files, improved RCS and SCCS interaction, GNU option parsing/configure conventions, and better POSIX compliance.

The README also explains why the FSF distributed GNU patch independently: Larry Wall had not released a new version since mid-1988, and he agreed to GNU distribution under the GNU General Public License. GNU bulletins from the 1990s describe patch as GNU's version of Larry Wall's program for applying diff output.

### Adoption history

patch became a standard Unix packaging primitive because source distributions could ship small textual changes instead of whole replacement trees. GNU patch's support for unified diffs, reject files, backup naming, and POSIX/GNU build conventions made it fit naturally into Autotools-era source packages and distribution build recipes.

### How it is used

The GNU diffutils manual shows the common form `patch <patchfile`, with optional original-file and patch-file arguments. If no patch file is supplied, patch reads diff output from standard input; if no input file is supplied, it tries to infer the file to edit from leading patch text.

### Why package nerds care

For package maintainers, GNU patch is infrastructure rather than just a user command. It is the tool behind downstream patch queues, source RPM and Debian patch application, vendor backports, portability fixes, and decades of email-driven source exchange before pull-request platforms normalized repository-hosted review.

### Timeline

- 1984: Larry Wall copyright years begin in the GNU patch README.
- 1988: The GNU patch README says Larry Wall had not released a new version since mid-1988.
- 1989: Free Software Foundation copyright years begin in the GNU patch README.
- 1990s: GNU bulletins list patch as GNU's version of Larry Wall's diff-applying program.
- 1997: GNU FTP archive lists patch 2.5.
- 2009: patch 2.6 adds a regression test suite, merge option, improved rejects, and GPLv3 licensing.
- 2012: patch 2.7 adds `diff --git` format support and path-safety checks.
- 2018: GNU FTP archive lists patch 2.7.6.
- 2025: GNU FTP archive lists patch 2.8.

### Related projects

- GNU diffutils produces the diff output commonly consumed by patch.
- RCS, SCCS, CVS, and later Git all coexist with patch-oriented workflows.
- Git's `git apply` and `git format-patch` continue the patch-file workflow in a repository-aware form.

### Sources

- <https://ftp.gnu.org/gnu/patch/>
- <https://ftp.gnu.org/gnu/patch/patch-2.7.6.tar.xz>
- <https://git.savannah.gnu.org/cgit/patch.git>
- <https://savannah.gnu.org/projects/patch>
- <https://www.gnu.org/bulletins/bull22.html>
- <https://www.gnu.org/software/diffutils/manual/html_node/Invoking-patch.html>


## 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:** gpatch
- **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

## Other Package-Manager Records

- MacPorts - gpatch: normalized package name match | MacPorts ports tree: devel/gpatch/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Debian apt - patch - 2.8-2: installed executable or alias match | Debian stable package indexes: patch from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Apply a diff file to an original | https://savannah.gnu.org/projects/patch/
- Nix - patch: installed executable or alias match | nixpkgs package indexes: patch from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix
- Ubuntu apt - patch - 2.7.6-7build3: installed executable or alias match | Ubuntu 24.04 LTS package indexes: patch from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | Apply a diff file to an original | https://savannah.gnu.org/projects/patch/
- apk - patch - 2.8-r0: installed executable or alias match | Alpine Linux edge package indexes: patch from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Utility to apply diffs to files | https://www.gnu.org/software/patch/patch.html
- apk - patch-doc - 2.8-r0: installed executable or alias match | Alpine Linux edge package indexes: patch-doc from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Utility to apply diffs to files (documentation) | https://www.gnu.org/software/patch/patch.html
- dnf - patch - 2.8-4.fc44: installed executable or alias match | Fedora Rawhide package metadata: patch from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | Utility for modifying/upgrading files | https://savannah.gnu.org/projects/patch/
- pacman - patch - 2.8-1: installed executable or alias match | Arch Linux sync databases: patch from https://geo.mirror.pkgbuild.com/core/os/x86_64/core.db.tar.gz | A utility to apply patch files to original sources | https://www.gnu.org/software/patch/
- zypper - patch - 2.8-2.3: installed executable or alias match | openSUSE Tumbleweed package metadata: patch from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | GNU patch | https://ftp.gnu.org/gnu/patch/
- Chocolatey - patch: installed executable or alias match | Chocolatey community package catalog: patch from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','openssh'
- Scoop - main/patch: installed executable or alias match | Scoop official bucket manifest trees: bucket/patch.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1
- winget - GnuWin32.Patch: installed executable or alias match | Windows Package Manager source index: GnuWin32.Patch from https://cdn.winget.microsoft.com/cache/source.msix


## 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.
- [Networking and protocol packages](https://www.automicvault.com/pkg/networking-protocol-tools/) - Matched network, protocol, or remote-service metadata.
- [dpkg](https://www.automicvault.com/pkg/brew/dpkg/) - Popular package that depends on this formula.
- [quilt](https://www.automicvault.com/pkg/brew/quilt/) - Popular package that depends on this formula.
- [diffutils](https://www.automicvault.com/pkg/brew/diffutils/) - Shares av.db curated category or tags: cli, developer-tools, diff, gnu.
- [jd](https://www.automicvault.com/pkg/brew/jd/) - Shares av.db curated category or tags: cli, developer-tools, diff, patch.
- [wdiff](https://www.automicvault.com/pkg/brew/wdiff/) - Shares av.db curated category or tags: cli, developer-tools, diff, gnu.
- [wiggle](https://www.automicvault.com/pkg/brew/wiggle/) - Shares av.db curated category or tags: cli, developer-tools, diff, patch.
- [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.
- [arm-none-eabi-binutils](https://www.automicvault.com/pkg/brew/arm-none-eabi-binutils/) - Shares av.db curated category or tags: cli, developer-tools, gnu.
- [autoconf](https://www.automicvault.com/pkg/brew/autoconf/) - Shares av.db curated category or tags: cli, developer-tools, gnu.
- [autogen](https://www.automicvault.com/pkg/brew/autogen/) - Shares av.db curated category or tags: cli, developer-tools, gnu.
- [parallel](https://www.automicvault.com/pkg/brew/parallel/) - Local package facts share a topical domain. Shared terms: cli, developer, developer-tools, gnu.

## Combined YAML source

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