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

Lightweight, POSIX-compliant regular expression (regex) library. Version 0.9.0 via Homebrew; verified from local package data.

## Install

```sh
sudo av install brew:tre
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install tre
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install tre
```

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

### Linux

- apk (92%):

```sh
sudo apk add agrep
```

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

- Debian apt (92%):

```sh
sudo apt install libtre-dev
```

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

- dnf (92%):

```sh
sudo dnf install agrep
```

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

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

- pacman (92%):

```sh
sudo pacman -S tre
```

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

- zypper (92%):

```sh
sudo zypper install agrep
```

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

## Package facts

- **Package key:** brew:tre
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/tre>
- **Version:** 0.9.0
- **Source summary:** Lightweight, POSIX-compliant regular expression (regex) library
- **Homepage:** <https://github.com/laurikari/tre>
- **Repository:** <https://github.com/laurikari/tre>
- **Upstream docs:** <https://github.com/laurikari/tre#readme>
- **License:** BSD-2-Clause
- **Source archive:** <https://github.com/laurikari/tre/releases/download/v0.9.0/tre-0.9.0.tar.gz>
- **Generated:** 2026-07-08T07:18:31+00:00

## Executables

- agrep (cli)
- agrep (alias)

## Install behavior

- Post-install hook: not defined
- 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: 0.9.0
- Local data: ok
- Upstream repository: https://github.com/laurikari/tre
- info: No package-manager update timestamp was available.
- info: No cached GitHub release or tag data was available.
## Project history and usage

TRE is Ville Laurikari's lightweight POSIX regular-expression matching library with approximate, or fuzzy, matching. In Homebrew it also matters because the package provides the `agrep` executable, an approximate grep-style command built on TRE.

### Project history

The official README presents TRE as a POSIX-compliant regexp matcher focused on robustness, predictable performance, and features uncommon in free POSIX implementations. It advertises approximate matching, strict standard conformance, linear worst-case matching time in the searched text, modest memory use, multibyte and wide-character support, binary data support, thread safety, and portability.

TRE's approximate matching uses edit distance, allowing insertions, deletions, and substitutions with configurable costs. The README notes that TRE's included `agrep` differs from older agrep implementations by allowing full regexps of any length, any number of errors, and non-uniform insertion, deletion, and substitution costs.

The NEWS file records a long release line. Earlier releases added approximate matching syntax, pkg-config support, non-greedy repetition, system ABI support, Unicode and wide-character improvements, Python bindings, command-line `agrep` options, Cygwin and MinGW builds, and license changes. Later releases changed the license to a BSD-style license in 0.7.6, introduced a `tre_`-prefixed ABI in 0.8.0, and added raw byte-vector API variants in 0.9.0.

### Adoption history

TRE's adoption history is mostly library-driven: C programs and Unix-like systems package it for POSIX regex compatibility plus fuzzy matching. The batch input records package-manager names such as Homebrew `tre`, Debian and Ubuntu `libtre-dev`, MacPorts `tre`, Nix `tre`, and `agrep` packages in apk, dnf, pacman, and zypper.

The split between library package names and `agrep` executable names explains why package catalogs can look inconsistent. Some ecosystems expose the library as TRE, while others emphasize the user-facing approximate grep command.

### How it is used

Library users compile and link against TRE for POSIX regex APIs with stronger matching guarantees, approximate matching, multibyte support, and thread-safe execution. The README documents the usual autotools build path through `./utils/autogen.sh`, `./configure`, `make`, `make check`, and `make install`.

Command-line users encounter TRE through `agrep`, which searches approximately rather than requiring exact matches. That makes it useful for typo-tolerant text search, OCR cleanup, fuzzy log investigation, and cases where edit-distance matching is more important than plain regular-expression grep.

### Why package nerds care

For package nerds, TRE is a compact example of a C library that survives because it offers a hard-to-replace semantic feature: POSIX-like regular expressions with approximate matching and predictable execution behavior.

The Homebrew formula's significance is partly in the executable it exposes. Installing `tre` gives users `agrep`, a niche but memorable command for fuzzy grep workflows, while also supplying headers and libraries that downstream software can build against.

### Timeline

- 0.5.x: NEWS records pkg-config support, system ABI work, minimal repetition operators, and best-match `agrep` mode.
- 0.7.6: NEWS records license change from LGPL to BSD-style and removal of gnulib due to potential license conflicts.
- 0.8.0: NEWS records `tre_` prefixes for exported libtre functions and an ABI change.
- 0.9.0: NEWS records raw byte-vector API variants and updated Visual Studio project files.

### Related projects

- Related to POSIX regex implementations such as Rx, Regex++, and AT&T ast regex, which the README mentions in its discussion of subpattern correctness.
- Related to earlier agrep implementations by Sun Wu and Udi Manber, which the README contrasts with TRE's included `agrep`.
- Related to grep-like command-line search tools, but distinguished by edit-distance matching.

### Sources

- Batch input fields: source_facts.description, source_facts.executables, source_facts.package-manager
- Official NEWS file: https://github.com/laurikari/tre/blob/master/NEWS
- Official README: https://github.com/laurikari/tre#readme


## Security Notes

library-like package without higher-risk signals.

- **Geiger risk:** green / low
- library-like package without higher-risk signals

## Source Database Details

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

- Debian apt - libtre-dev - 0.9.0-1: normalized package name match | Debian stable package indexes: libtre-dev from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | development package for the libtre5 regexp matching library | https://laurikari.net/tre/
- Debian apt - libtre5 - 0.9.0-1: normalized package name match | Debian stable package indexes: libtre5 from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | regexp matching library with approximate matching | https://laurikari.net/tre/
- Debian apt - tre-agrep - 0.9.0-1: normalized package name match | Debian stable package indexes: tre-agrep from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | approximate grep utility based on the tre library | https://laurikari.net/tre/
- Nix - tre: normalized package name match | nixpkgs package indexes: pkgs/by-name/tr/tre/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - libtre-dev - 0.8.0-7: normalized package name match | Ubuntu 24.04 LTS package indexes: libtre-dev from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | development package for the libtre5 regexp matching library | https://laurikari.net/tre/
- Ubuntu apt - libtre5 - 0.8.0-7: normalized package name match | Ubuntu 24.04 LTS package indexes: libtre5 from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | regexp matching library with approximate matching | https://laurikari.net/tre/
- Ubuntu apt - tre-agrep - 0.8.0-7: normalized package name match | Ubuntu 24.04 LTS package indexes: tre-agrep from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | approximate grep utility based on the tre library | https://laurikari.net/tre/
- apk - agrep - 0.8.0-r2: normalized package name match | Alpine Linux edge package indexes: agrep from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | approximate grepping | https://laurikari.net/tre
- apk - agrep-doc - 0.8.0-r2: normalized package name match | Alpine Linux edge package indexes: agrep-doc from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | POSIX compliant regexp matching library (documentation) | https://laurikari.net/tre
- apk - tre - 0.8.0-r2: normalized package name match | Alpine Linux edge package indexes: tre from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | POSIX compliant regexp matching library | https://laurikari.net/tre
- apk - tre-dev - 0.8.0-r2: normalized package name match | Alpine Linux edge package indexes: tre-dev from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | POSIX compliant regexp matching library (development files) | https://laurikari.net/tre
- apk - tre-static - 0.8.0-r2: normalized package name match | Alpine Linux edge package indexes: tre-static from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | POSIX compliant regexp matching library (static library) | https://laurikari.net/tre
- dnf - agrep - 0.9.0-4.fc45: normalized package name match | Fedora Rawhide package metadata: agrep from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | Approximate grep utility | http://laurikari.net/tre/
- dnf - python3-tre - 0.9.0-4.fc45: normalized package name match | Fedora Rawhide package metadata: python3-tre from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | Python bindings for the tre library | http://laurikari.net/tre/
- dnf - tre - 0.9.0-4.fc45: normalized package name match | Fedora Rawhide package metadata: tre from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | POSIX compatible regexp library with approximate matching | http://laurikari.net/tre/
- dnf - tre-common - 0.9.0-4.fc45: normalized package name match | Fedora Rawhide package metadata: tre-common from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/e5ca8ce900cd68f5419e1c39ae517343100b306336cbaeb70a3c153121d95094-primary.xml.zst | Cross-platform files for use with the tre package | http://laurikari.net/tre/


## 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.
- [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.
- [felinks](https://www.automicvault.com/pkg/brew/felinks/) - Popular package that depends on this formula.
- [genometools](https://www.automicvault.com/pkg/brew/genometools/) - Popular package that depends on this formula.
- [vis](https://www.automicvault.com/pkg/brew/vis/) - Popular package that depends on this formula.
- [enchant](https://www.automicvault.com/pkg/brew/enchant/) - Shares av.db curated category or tags: cli, developer-tools, library.
- [gflags](https://www.automicvault.com/pkg/brew/gflags/) - Shares av.db curated category or tags: cli, developer-tools, library.
- [grex](https://www.automicvault.com/pkg/brew/grex/) - Shares av.db curated category or tags: cli, developer-tools, regex, regular-expressions.
- [libvterm](https://www.automicvault.com/pkg/brew/libvterm/) - Shares av.db curated category or tags: cli, developer-tools, library.
- [lunar-date](https://www.automicvault.com/pkg/brew/lunar-date/) - Shares av.db curated category or tags: cli, developer-tools, library.
- [melody](https://www.automicvault.com/pkg/brew/melody/) - Shares av.db curated category or tags: cli, developer-tools, regex, regular-expressions.
- [notcurses](https://www.automicvault.com/pkg/brew/notcurses/) - Shares av.db curated category or tags: cli, developer-tools, library.
- [pomsky](https://www.automicvault.com/pkg/brew/pomsky/) - Shares av.db curated category or tags: cli, developer-tools, regex, regular-expressions.
- [grok](https://www.automicvault.com/pkg/brew/grok/) - Local package facts share a topical domain. Shared terms: cli, developer, developer-tools, expressions, matching.
- [oniguruma](https://www.automicvault.com/pkg/brew/oniguruma/) - Local package facts share a topical domain. Shared terms: cli, developer, developer-tools, expressions, posix.
- [onigmo](https://www.automicvault.com/pkg/brew/onigmo/) - Local package facts share a topical domain. Shared terms: cli, developer, developer-tools, expressions, regular.

## Combined YAML source

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