# Install gnu-getopt with Homebrew, zypper, Nix

Command-line option parsing utility. Version 2.42.2 via Homebrew; verified 2026-06-16.

## Install

```sh
sudo av install brew:gnu-getopt
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install gnu-getopt
```

  Evidence: local Homebrew formula metadata

### Linux

- zypper (92%):

```sh
sudo zypper install gnu-getopt
```

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

- Nix (92%):

```sh
nix profile install nixpkgs#getopt
```

  Evidence: nixpkgs package indexes: pkgs/by-name/ge/getopt/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

## Package facts

- **Package key:** brew:gnu-getopt
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/gnu-getopt>
- **Version:** 2.42.2
- **Source summary:** Command-line option parsing utility
- **Homepage:** <https://github.com/util-linux/util-linux>
- **Repository:** <https://github.com/util-linux/util-linux>
- **Upstream docs:** <https://github.com/util-linux/util-linux/blob/master/misc-utils/getopt.1.adoc>
- **License:** GPL-2.0-or-later
- **Source archive:** <https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.42/util-linux-2.42.2.tar.gz>
- **Last updated:** 2026-06-16T16:47:43Z
- **Generated:** 2026-07-09T07:20:21+00:00

## Executables

- getopt (cli)
- getopt (alias)

## Install behavior

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

## Freshness

- Page generated: 2026-07-09
- Package-manager version: 2.42.2
- Package-manager updated: 2026-06-16
- Local data: ok
- Upstream repository: https://github.com/util-linux/util-linux
- info: No cached GitHub release or tag data was available.
## Project history and usage

`gnu-getopt` packages util-linux's enhanced `getopt(1)` command, a shell-facing option parser that uses GNU `getopt(3)` behavior and is commonly installed separately where the base system ships a less capable `getopt`.

### Project history

The upstream project is util-linux, described by its README as a collection of Linux utilities. util-linux carried the name util-linux-ng from 2006 through 2010, then continued under the util-linux name with kernel.org as the primary source location and GitHub as a backup web interface.

The util-linux NEWS file records `getopt` updates in the 2.11 and 2.13 development era, including replacement with getopt 1.1.3 by Frodo Looijaard and an update to 1.1.4. The man page identifies the command as the enhanced `getopt`, focused on parsing command options for shell procedures.

### Adoption history

As part of util-linux, enhanced `getopt` is part of the broad Linux userland toolbox. On macOS, Homebrew packages it as `gnu-getopt` and marks it keg-only because macOS provides BSD `getopt`; on Linux, the formula also avoids conflict with the full util-linux package. That packaging split is the main reason the Homebrew package name differs from the upstream project name.

### How it is used

Practitioners use `getopt` in shell scripts to normalize short and long options, detect invalid arguments, preserve whitespace through shell quoting, and test whether the enhanced implementation is present. The `-T` probe is explicitly documented for distinguishing this implementation from older `getopt(1)` variants.

### Why package nerds care

The package matters because option parsing is a portability trap in shell scripts. Installing `gnu-getopt` gives macOS and other non-GNU environments the util-linux behavior many Linux-oriented scripts expect, while Homebrew's keg-only status prevents accidental replacement of the system utility.

### Timeline

- 2001-era util-linux 2.11z: NEWS records replacement with getopt 1.1.3 by Frodo Looijaard.
- 2007: util-linux-ng 2.13-pre6 NEWS records update to getopt 1.1.4.
- 2006-2010: util-linux project used the util-linux-ng name.
- 2026: util-linux README described kernel.org as primary repository and GitHub as backup.

### Related projects

- GNU `getopt(3)` supplies the parsing behavior used by util-linux `getopt(1)`.
- BSD `getopt` is the system utility that Homebrew avoids shadowing on macOS.
- util-linux is the upstream userland utility collection that contains the command.

### Sources

- <https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/g/gnu-getopt.rb>
- <https://raw.githubusercontent.com/util-linux/util-linux/master/NEWS>
- <https://raw.githubusercontent.com/util-linux/util-linux/master/README>
- <https://raw.githubusercontent.com/util-linux/util-linux/master/misc-utils/getopt.1.adoc>


## Security Notes

No matching local secret-handling manifest was found for gnu-getopt. Nucleus package metadata is still published here so future coverage has a stable package URL.


## Source Database Details

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** gnu-getopt
- **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

- zypper - gnu-getopt - 1.0.14-2.7: normalized package name match | openSUSE Tumbleweed package metadata: gnu-getopt from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Java getopt Implementation | https://www.urbanophile.com/arenn/hacking/download.html
- zypper - gnu-getopt-javadoc - 1.0.14-2.7: normalized package name match | openSUSE Tumbleweed package metadata: gnu-getopt-javadoc from https://download.opensuse.org/tumbleweed/repo/oss/repodata/be8d3611d25469107f32075a1697e69ec57a2b850b42348a658cc671ad5ec2b50760d02c3e59524d50da9a11d5be799bdaffba2e166e8ca8858512e3c0bd665d-primary.xml.zst | Javadoc for gnu.getopt | https://www.urbanophile.com/arenn/hacking/download.html
- Nix - getopt: installed executable or alias match | nixpkgs package indexes: pkgs/by-name/ge/getopt/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1


## Related links

- [Source-control packages](https://www.automicvault.com/pkg/source-control-tools/) - Belongs to a source-control command family.
- [Terminal utility packages](https://www.automicvault.com/pkg/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Networking and protocol packages](https://www.automicvault.com/pkg/networking-protocol-tools/) - Matched network, protocol, or remote-service metadata.
- [Homebrew utility packages](https://www.automicvault.com/pkg/brew-utility-packages/) - Matched curated package taxonomy and local package facts.
- [beakerlib](https://www.automicvault.com/pkg/brew/beakerlib/) - Popular package that depends on this formula.
- [git-now](https://www.automicvault.com/pkg/brew/git-now/) - Popular package that depends on this formula.
- [pass](https://www.automicvault.com/pkg/brew/pass/) - Popular package that depends on this formula.
- [xmlto](https://www.automicvault.com/pkg/brew/xmlto/) - Popular package that depends on this formula.
- [util-linux](https://www.automicvault.com/pkg/brew/util-linux/) - Shares the same upstream source repository.
- [csvprintf](https://www.automicvault.com/pkg/brew/csvprintf/) - Local package facts share a topical domain. Shared terms: command-line, line, parsing.

## Combined YAML source

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


## Sources

- Nucleus package database
- package-page enrichment
- curated package history
- package version freshness
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
