# Install grepcidr with Homebrew, apt, dnf, MacPorts, Nix, zypper

Filter IP addresses matching IPv4 CIDR/network specification. Version 2.0 via Homebrew; verified from local package data. Also installable with debian: sudo apt install grepcidr.

## Install

```sh
sudo av install brew:grepcidr
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install grepcidr
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install grepcidr
```

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

### Linux

- Debian apt (92%):

```sh
sudo apt install grepcidr
```

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

- dnf (92%):

```sh
sudo dnf install grepcidr
```

  Evidence: Fedora Rawhide package metadata: grepcidr from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#grepcidr
```

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

- zypper (92%):

```sh
sudo zypper install grepcidr
```

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

## Package facts

- **Package key:** brew:grepcidr
- **Package manager:** Homebrew
- **Version:** 2.0
- **Source summary:** Filter IP addresses matching IPv4 CIDR/network specification
- **Homepage:** <https://www.pc-tools.net/unix/grepcidr/>
- **Generated:** 2026-08-03T19:37:03+00:00

## Executables

- grepcidr (alias)

## Install behavior

- Bottle: not available

## Freshness

- Page generated: 2026-08-03
- Package-manager version: 2.0
## Project history and usage

grepcidr is a small C command-line filter for matching IPv4 and IPv6 addresses against CIDR patterns. It borrows grep's interface style for a networking-specific job: select or reject log lines by address range.

### Project history

Jem Berkes identifies the pc-tools.net grepcidr as the original project, created in 2004 and released as grepcidr 2.0 on 2014-05-26. The official page emphasizes that the 2.0 line is distinct from John Levine's separately developed fork, even though both names can confuse users.

Version 2.0 added IPv6 support, replaced a regex-based scanner with a hints scanner reported as faster on some platforms, enforced stricter IP text matching, added multiple file arguments, supported unlimited input line length, and improved CIDR validation.

### Adoption history

grepcidr's niche is operational networking: mail filtering, network security, log analysis, and custom pipelines where a full IP-address database or firewall tool would be too heavy. Its adoption in package managers follows from being a single-purpose Unix filter with no documented configuration or credential state.

### How it is used

The official examples show grepcidr matching an IPv6 documentation prefix against a log file and matching a Googlebot-era IPv4 CIDR range against access.log. Options include count output, inverted matching, strict CIDR alignment, strict start-of-line matching, command-line patterns, and pattern files.

### Why package nerds care

grepcidr is package-nerd significant because it is a tiny specialist filter that fills a gap between grep and heavier network-analysis tools. It lets shell users keep grep-like pipelines while making CIDR math correct enough for log and abuse workflows.

The official fork note matters for packaging: downstreams need to know whether they are shipping Berkes' grepcidr 2.0 line or Levine's unrelated implementation.

### Timeline

- 2004: Original grepcidr project created, according to the official project page.
- 2014: grepcidr 2.0 released with IPv6 support, faster scanning, stricter matching, and multiple-file support.
- 2014: Official page documented the distinction between Berkes' project and the separately developed grepcidr-2 fork.

### Related projects

- grep is the interface model for matching and inverted matching.
- John Levine's grepcidr-2 fork is called out by the official page as an unrelated implementation.
- Spamhaus is credited on the official page for sponsorship and testing of features.

### Sources

- <https://www.pc-tools.net/unix/grepcidr>


## Security Notes

broad file, network, media, or database tool signal.

- **Geiger risk:** blue / medium
- broad file, network, media, or database tool signal

## Other Package-Manager Records

- Debian apt - grepcidr - 2.0-2: normalized package name match | Debian stable package indexes: grepcidr from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Filter IP addresses matching IPv4/IPv6 CIDR/network specification | http://www.pc-tools.net/unix/grepcidr/
- Nix - grepcidr: normalized package name match | nixpkgs package indexes: pkgs/by-name/gr/grepcidr/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - grepcidr - 2.0-2: normalized package name match | Ubuntu 24.04 LTS package indexes: grepcidr from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Filter IP addresses matching IPv4/IPv6 CIDR/network specification | http://www.pc-tools.net/unix/grepcidr/
- dnf - grepcidr - 2.0-13.fc45: normalized package name match | Fedora Rawhide package metadata: grepcidr from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Filter IPv4 and IPv6 addresses matching CIDR patterns | https://www.pc-tools.net/unix/grepcidr/
- zypper - grepcidr - 2.0-2.8: normalized package name match | openSUSE Tumbleweed package metadata: grepcidr from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Filter IP addresses matching IPv4/IPv6 CIDR specification | http://www.pc-tools.net/unix/grepcidr/
- MacPorts - grepcidr: normalized package name match | MacPorts ports tree: sysutils/grepcidr/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## Combined YAML source

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


## Sources

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
