ripgrep vs The Silver Searcher
ripgrep vs The Silver Searcher (ag): Rust vs C, ignore-file handling, regex engines, encodings, editor plugins and when to pick each.
Updated
short verdict
Pick ripgrep if you need Windows support, searches in non-UTF-8 or compressed files, PCRE2 look-around, or a config file. Pick The Silver Searcher if you already use it through ack.vim or ag.el, or if you want `.hgignore` support. For plain recursive code search, ripgrep's own benchmarks show it ahead of ag.
Both tools recursively search a directory tree for a regex and skip files your ignore rules exclude, so the basic workflow is the same. They differ in what they search beyond source text, which ignore files they read, which regex engines they use, and which editors they plug into. ripgrep is written in Rust and The Silver Searcher (ag) is written in C under Apache-2.0.
this page is for
- Developers choosing a grep replacement for code search
- Anyone migrating from ack to a faster tool
- Teams that need the same search tool on Windows, macOS and Linux
- Vim or Emacs users who already have an ag-based plugin
The better pick when you need broader search features: encodings, compressed files, PCRE2, a config file, or Windows support.
best for
- Searching beyond plain UTF-8 source
- Cross-platform teams including Windows
- Patterns needing look-around or backreferences
strengths
- `-E/--encoding` handles UTF-16, latin-1, GBK, EUC-JP and Shift_JIS files
- `-z/--search-zip` searches gzip, bzip2, xz, lz4, lzma, brotli and zstandard files
- `-P/--pcre2` adds look-around and backreferences missing from the default engine
- File type filters such as `rg -tpy foo` and `rg -Tjs foo`, plus a config file
weaknesses
- No editor integrations are documented by the project, unlike ag's Vim, Emacs and TextMate support
- Reads gitignore rules but documents no `.hgignore` handling
The better pick when you rely on its editor plugins or on Mercurial ignore files, or when you want an ack-style command.
best for
- Vim users on ack.vim and Emacs users on ag.el
- Repositories that use `.hgignore`
- People coming from ack who want a shorter command
strengths
- Honors `.gitignore`, `.hgignore` and custom `.ignore` files
- Documented integrations with Vim (ack.vim), Emacs (ag.el) and TextMate
- Multithreaded with Pthreads, memory-mapped reads, Boyer-Moore for literals and PCRE JIT for regexes
- Packaged in Homebrew (`the_silver_searcher`), APT (`silversearcher-ag`) and DNF
weaknesses
- No documented support for other text encodings, compressed files or input preprocessing
- Uses PCRE only; there is no alternative engine switch like ripgrep's `-P`
- Its documented benchmark is against ack, not against ripgrep
Key differences
- Language: ripgrep is written in Rust; The Silver Searcher is written in C and licensed Apache-2.0.
- Ignore files: ripgrep follows gitignore rules; ag reads `.gitignore`, `.hgignore` and custom `.ignore` files.
- Regex engine: ripgrep has a default engine with optional PCRE2 via `-P`; ag uses PCRE with JIT compilation.
- Scope: ripgrep adds encodings, compressed files, preprocessing filters and a config file; ag focuses on code search.
- Editor integrations: ag documents Vim (ack.vim), Emacs (ag.el) and TextMate; ripgrep documents none.
- Platforms: ripgrep lists first-class Windows, macOS and Linux support; ag is described as available on all major platforms.
Choose ripgrep when
- You search UTF-16, Shift_JIS or other non-UTF-8 files with `-E/--encoding`.
- You need to search compressed files with `-z` or filter input, such as PDF text extraction.
- Your patterns need look-around or backreferences through `-P/--pcre2`.
- You want to include ignored or hidden files quickly with `rg -uuu`.
Choose The Silver Searcher when
- Your editor setup already uses ack.vim, ag.el or TextMate integration.
- Your repositories use `.hgignore` alongside or instead of `.gitignore`.
- You are replacing ack and want a similar command line under the shorter name `ag`.
When not to use these
- You need structural or syntax-aware code search, since both tools match lines with regexes only.
- You need to edit files in bulk; ripgrep's replacement is described as rudimentary and ag documents none.
FAQ
- Which is faster, ripgrep or The Silver Searcher?
- ripgrep's documentation reports benchmarks where it outperforms grep, ag and ack, especially on Unicode-enabled searches. ag documents speed against ack (up to 34x faster) but does not publish a comparison against ripgrep. Results on your own code base may differ.
- Can I install both ripgrep and ag?
- Yes. The commands are `rg` and `ag`, so they do not collide. Neither project documents using them together, but nothing in either prevents it.
- Which one is easier to configure?
- ripgrep documents configuration file support. ag documents no config file, but it reads `.ignore` files to exclude patterns. Neither project documents a comparison of setup effort.
- Do both respect .gitignore?
- Yes. ripgrep applies gitignore rules by default and skips hidden and binary files, which `rg -uuu` disables. ag respects `.gitignore` and `.hgignore` and supports custom `.ignore` files.