Open-Source Wikis

/

ripgrep

/

How to contribute

/

Tooling

BurntSushi/ripgrep

Tooling

The build, lint, CI, and release tooling used by the project.

Build system

cargo is the only build tool. There is no Makefile, no build.sh, no xtask. Everything is driven by Cargo.toml files at the root and in each crate.

The root build.rs exists, but it only sets compile-time variables (host triple, CARGO_PKG_VERSION) and does no code generation.

Profiles

Cargo.toml defines four profiles:

Profile Purpose
dev (default) Fast incremental builds during development. Inherits Cargo defaults.
release Optimised, with debug = 1 for useful backtraces. What cargo build --release produces.
release-lto Adds full LTO (lto = "fat"), strips symbols, sets panic = "abort". Used for distribution binaries.
deb Inherits from release-lto. Used by cargo deb to build the Debian package.

Both release-lto and deb use a single codegen unit and incremental = false, so the linked binary is as small and fast as possible. The trade-off is link time.

Allocator

On 64-bit musl Linux only, ripgrep links tikv-jemallocator. Configured by:

[target.'cfg(all(target_env = "musl", target_pointer_width = "64"))'.dependencies.tikv-jemallocator]
version = "0.6.0"

Glibc's allocator is left alone because it is competitive with jemalloc for ripgrep's workload. The static-musl binary uses jemalloc because musl's allocator is slow under contention. See the comment in crates/core/main.rs for the rationale.

Formatting and linting

Tool Config Run
rustfmt rustfmt.toml cargo fmt
clippy None (use defaults) cargo clippy --all

Both are enforced in CI via .github/workflows/ci.yml.

CI

.github/workflows/ci.yml runs on every push and PR. Matrix:

  • Rust toolchain: stable, beta, 1.85 (MSRV).
  • OS: Ubuntu, macOS, Windows.
  • Features: default and pcre2.
  • Cross-compilation: musl, aarch64.

Every job runs cargo build, cargo test --all, and (for one job) cargo fmt --check and cargo clippy --all.

Release pipeline

.github/workflows/release.yml runs when a v* tag is pushed. It:

  1. Cuts source archives (.tar.gz and .zip).
  2. Builds platform-specific archives (Linux GNU, Linux musl, macOS x86_64, macOS aarch64, Windows MSVC, Windows GNU, Windows aarch64, FreeBSD, several ARM Linux variants).
  3. Builds a Debian .deb via cargo deb.
  4. Generates the man page and shell completions (rg --generate man, rg --generate complete-bash, etc.).
  5. Uploads everything to the GitHub release.

The full matrix and per-target configuration live in .github/workflows/release.yml. The RELEASE-CHECKLIST.md document is the human checklist that wraps this workflow.

Local helper scripts

The ci/ directory contains a small number of shell scripts that the workflows call:

  • ci/build-deb — builds a Debian package locally with the same flags as CI.
  • ci/test-complete — sanity-checks the generated shell completions.

The scripts/ directory holds maintainer utilities not used by CI. They are excluded from published crates.io artifacts via exclude in Cargo.toml.

Documentation generation

The man page and shell completions are generated by the rg binary itself, not a separate tool:

rg --generate man               # roff man page
rg --generate complete-bash     # bash completion
rg --generate complete-zsh      # zsh completion
rg --generate complete-fish     # fish completion
rg --generate complete-powershell

Implementations are in crates/core/flags/doc/ (man page, help output) and crates/core/flags/complete/ (per-shell completions). The data feeding these generators is the same Flag trait registry that drives runtime flag parsing.

Dependency policy

ripgrep's binary depends on a small, hand-curated set of crates:

  • anyhow, bstr, lexopt, log, serde_json, termcolor, textwrap — utility libraries
  • grep and ignore — the project's own crates
  • tikv-jemallocator — only on musl

There is no tokio, no clap, no reqwest, no rayon. New transitive dependencies are scrutinised; the policy is "smallest reasonable dependency footprint".

The library crates have similarly minimal dependency lists.

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

Tooling – ripgrep wiki | Factory