How to Fix bash: ripgrep: command not found in Minimal Linux Distributions

The ripgrep (rg) utility is a line-oriented search tool written in Rust that recursively searches directories for regex patterns while respecting gitignore rules and skipping binary files, operating orders of magnitude faster than traditional GNU grep. In newly deployed minimal Linux installations, container base images, or remote VPS servers, running ripgrep or its short alias rg returns bash: ripgrep: command not found because the utility is not part of default Linux distributions, or because distributions package it under the binary name rg.

Install ripgrep via Distribution Package Repositories

Most modern Linux package managers feature ripgrep directly in official repositories:

# On Debian or Ubuntu (20.04+):
sudo apt update && sudo apt install -y ripgrep

# On Arch Linux:
sudo pacman -S ripgrep

# On Alpine Linux:
apk add ripgrep

# On Fedora or RHEL 9:
sudo dnf install -y ripgrep

# Verify installation (the binary is named 'rg')
rg --version

Create a ripgrep Alias for the Short rg Binary

Most Linux distributions install the binary with the command name rg rather than ripgrep. If your scripts invoke ripgrep explicitly, create an alias or symlink:

# Create symlink in system binary path
sudo ln -s $(which rg) /usr/local/bin/ripgrep

# Or add alias to your shell profile
echo 'alias ripgrep="rg"' >> ~/.bashrc
source ~/.bashrc

# Test command execution
ripgrep --version

Install via Pre-Compiled Static Binary

For minimal container environments without package manager registries, download the official pre-compiled release binary:

# Download latest ripgrep archive for Linux x86_64
curl -sSL https://github.com/BurntSushi/ripgrep/releases/latest/download/ripgrep-14.1.0-x86_64-unknown-linux-musl.tar.gz -o /tmp/ripgrep.tar.gz

# Extract binary directly into system bin
sudo tar -xzf /tmp/ripgrep.tar.gz -C /usr/local/bin/ --strip-components=1 --wildcards '*/rg'

# Create matching ripgrep symlink
sudo ln -s /usr/local/bin/rg /usr/local/bin/ripgrep

# Clean up archive
rm -f /tmp/ripgrep.tar.gz

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.