# Install hgrep with Homebrew, MacPorts, Nix

Grep with human-friendly search results. Version 0.3.9 via Homebrew; verified from local package data.

## Install

```sh
sudo av install brew:hgrep
```

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install hgrep
```

  Evidence: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install hgrep
```

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

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#hgrep
```

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

## Package facts

- **Package key:** brew:hgrep
- **Package manager:** Homebrew
- **Package manager page:** <https://formulae.brew.sh/formula/hgrep>
- **Version:** 0.3.9
- **Source summary:** Grep with human-friendly search results
- **Homepage:** <https://github.com/rhysd/hgrep>
- **Repository:** <https://github.com/rhysd/hgrep>
- **Upstream docs:** <https://github.com/rhysd/hgrep#readme>
- **License:** MIT
- **Source archive:** <https://github.com/rhysd/hgrep/archive/refs/tags/v0.3.9.tar.gz>
- **Generated:** 2026-07-08T07:18:31+00:00

## Executables

- hgrep (cli)
- hgrep (alias)

## Build dependencies

- rust

## 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-08
- Package-manager version: 0.3.9
- Local data: ok
- Upstream repository: https://github.com/rhysd/hgrep
- Upstream latest detected: v0.3.9 (current)
- info: No package-manager update timestamp was available.
## Project history and usage

hgrep is a Rust command-line search presenter that aims to make local grep results look more like code-search output: matched regions are shown as syntax-highlighted snippets with useful surrounding context.

Its niche is deliberately narrow. Rather than replacing grep or ripgrep outright, it wraps a built-in subset of ripgrep or reads `grep -nH` and `rg -nH` output from standard input, then formats results with syntect or bat-backed printers.

### Project history

The public release line begins with v0.1.x tags in October 2021. The README describes the original product idea as combining ripgrep-style search with bat-style highlighted display, while keeping a pipe-friendly mode for existing grep workflows.

The 0.2 and 0.3 series show the project tightening around terminal ergonomics: generated shell completions and man pages, binary release archives, static Linux builds, macOS and Windows support, and improved handling of color capability and encodings.

### Adoption history

The official README documents installation through release binaries, Homebrew, MacPorts, NetBSD pkgsrc/pkgin, Debian-style `.deb` packages, and Cargo. That packaging spread matches hgrep's role as a small terminal utility rather than a library platform.

The project also exposes feature flags so users can keep the built-in ripgrep search, the syntect printer, or the bat printer, which made it practical for package maintainers and source builders to tune dependency weight.

### How it is used

Typical use is either `hgrep pattern path` for its built-in ripgrep subset or `rg -nH pattern path | hgrep` when the user wants full ripgrep behavior and hgrep only as the display stage.

hgrep is most useful when raw grep output has too little context: it groups nearby matches, chooses context around blank lines, applies syntax highlighting, and can generate shell completions or a manual page for packaged installs.

### Why package nerds care

For package-manager users, hgrep is an example of the Rust CLI ecosystem's composable-search style: ripgrep supplies fast traversal and matching, bat/syntect supply readable code presentation, and the final binary stays scriptable.

It is also interesting as a dependency-shaping package. Builders can choose feature combinations to trade install time, binary size, and formatting behavior instead of carrying every optional printer path.

### Timeline

- 2021: v0.1.x public tags establish the Rust CLI release line.
- 2021: v0.2.0 follows within weeks, continuing rapid terminal-search iteration.
- 2023: v0.3.0 updates syntect and bat integration and adds manual-page generation.
- 2024: v0.3.7 adds broader text-encoding support, including BOM-based detection.
- 2025: v0.3.9 adds Arm Windows release artifacts and additional language/theme support.

### Related projects

- ripgrep is the closest search-engine relative: hgrep can embed a subset of ripgrep or consume `rg -nH` output.
- bat and syntect are presentation relatives: hgrep uses them as alternative syntax-highlighted output paths.
- Traditional grep remains part of the workflow because hgrep can read `grep -nH` output from standard input.

### Sources

- Changelog: https://github.com/rhysd/hgrep/blob/master/CHANGELOG.md
- README: https://github.com/rhysd/hgrep#readme
- Repository tags: https://github.com/rhysd/hgrep/tags


## 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:** hgrep
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

## Other Package-Manager Records

- Nix - hgrep: normalized package name match | nixpkgs package indexes: pkgs/by-name/hg/hgrep/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- MacPorts - hgrep: normalized package name match | MacPorts ports tree: textproc/hgrep/Portfile from https://api.github.com/repos/macports/macports-ports/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.
- [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.
- [rust](https://www.automicvault.com/pkg/brew/rust/) - Build dependency declared by Homebrew.
- [igrep](https://www.automicvault.com/pkg/brew/igrep/) - Shares av.db curated category or tags: cli, developer-tools, grep, ripgrep, search.
- [vgrep](https://www.automicvault.com/pkg/brew/vgrep/) - Shares av.db curated category or tags: cli, developer-tools, grep, search, terminal.
- [ddgr](https://www.automicvault.com/pkg/brew/ddgr/) - Shares av.db curated category or tags: cli, developer-tools, search, terminal.
- [fzf](https://www.automicvault.com/pkg/brew/fzf/) - Shares av.db curated category or tags: cli, developer-tools, search, terminal.
- [jvgrep](https://www.automicvault.com/pkg/brew/jvgrep/) - Shares av.db curated category or tags: cli, developer-tools, grep, search.
- [ripgrep](https://www.automicvault.com/pkg/brew/ripgrep/) - Shares av.db curated category or tags: cli, developer-tools, grep, search.
- [ripgrep-all](https://www.automicvault.com/pkg/brew/ripgrep-all/) - Shares av.db curated category or tags: cli, developer-tools, ripgrep, search.
- [sift](https://www.automicvault.com/pkg/brew/sift/) - Shares av.db curated category or tags: cli, developer-tools, grep, search.

## Combined YAML source

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