Open-Source Wikis

/

ripgrep

/

Reference

/

Dependencies

BurntSushi/ripgrep

Dependencies

ripgrep's dependency policy is "smallest reasonable footprint". The Cargo.lock for the binary contains roughly 61 unique transitive crates at present.

Direct dependencies of the ripgrep binary

From the root Cargo.toml:

Crate Purpose
anyhow Error type for the binary
bstr Byte-string utilities (heavily used; haystacks are not always UTF-8)
grep Facade re-exporting all the search libraries
ignore Recursive, ignore-aware directory walker
lexopt CLI argument parser (replaced clap in 14.0.0)
log Logging hooks, plumbed by --debug/--trace
serde_json --json output format
termcolor Cross-platform terminal coloring
textwrap Wraps --help output to terminal width

Optional (target-specific):

Crate Condition Purpose
tikv-jemallocator 64-bit musl Linux only Replaces musl's allocator with jemalloc

Dev-only:

  • serde, serde_derive, walkdir

Direct dependencies of the library crates

Library Notable direct deps
grep grep-cli, grep-matcher, grep-printer, grep-regex, grep-searcher, optional grep-pcre2
grep-cli bstr, globset, log, termcolor
grep-matcher memchr (only)
grep-pcre2 pcre2, grep-matcher, log, bstr
grep-printer bstr, grep-matcher, grep-searcher, termcolor, optional serde, serde_json
grep-regex regex, regex-automata, regex-syntax, aho-corasick, bstr, grep-matcher, log
grep-searcher bstr, encoding_rs, encoding_rs_io, grep-matcher, log, memchr, memmap2
globset regex-automata, regex-syntax, bstr, aho-corasick, log, optional serde
ignore globset, walkdir, crossbeam-deque, crossbeam-channel, same-file (Unix), bstr, regex, log

Transitive dependencies of note

Pulled in indirectly:

  • regex family: regex, regex-automata, regex-syntax. The core regex engine; ripgrep's literal-extraction layer (grep-regex/src/literal.rs) uses regex-syntax's HIR directly.
  • aho-corasick: Multi-pattern literal matching, used internally by both regex and ripgrep's literal optimisations.
  • memchr: SIMD-accelerated byte search. Used everywhere a single-byte scan can replace a regex.
  • memmap2: Memory-mapping for fast single-file search.
  • encoding_rs: Used when --encoding is set (and for UTF-16 BOM detection).
  • crossbeam-deque, crossbeam-channel: Lock-free work distribution for WalkParallel.

Build-time dependencies

The root build.rs depends on nothing. It just sets compile-time variables (host triple, version) using cargo:rerun-if-changed directives.

The pcre2-sys crate (a transitive dependency when the pcre2 feature is enabled) has its own build script that:

  • Looks for a system PCRE2 via pkg-config.
  • If absent, builds bundled PCRE2 source via cc.

This is the only cc (C compiler) requirement in the workspace, and only when pcre2 is enabled.

Conspicuous absences

ripgrep deliberately does not depend on:

  • clap (replaced by lexopt in 14.0.0). The hand-rolled Flag registry handles parsing, doc generation, and completion generation.
  • tokio or any async runtime. All concurrency uses std::thread and crossbeam channels.
  • rayon. Parallelism is explicit; WalkParallel owns the thread pool.
  • reqwest, hyper, serde_yaml, etc. ripgrep is offline and self-contained.

Adding a new dependency is unusual and gets scrutiny in code review. The maintainer favors small dependencies with stable APIs over feature-rich crates.

Version pinning

Version requirements in the root Cargo.toml and library Cargo.tomls use Cargo's default semver requirements (e.g., bstr = "1.7.0" accepts any 1.x ≥ 1.7.0). The Cargo.lock is committed and the CI matrix tests against locked versions.

Updating dependencies

RELEASE-CHECKLIST.md calls for cargo update before cutting a release. There is no Dependabot or Renovate; updates happen manually as part of the release cycle. The maintainer reviews the diff in Cargo.lock for surprises.

Cargo feature flags exposed by ripgrep

Feature Default? Effect
pcre2 No Pull in grep-pcre2 and link PCRE2; enables -P/--pcre2
(no others) The historical simd-accel and avx-accel were removed in 14.1.1

Library crates expose their own features:

  • grep: pcre2 (forwards to grep-pcre2), simd-accel and avx-accel (deprecated no-ops).
  • grep-printer: serde (enables JSON printer).
  • globset: serde1 (enables Serialize/Deserialize for Glob).

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Dependencies – ripgrep wiki | Factory