Getting Started

From zero to sub-millisecond search in under 5 minutes. No configuration files. No daemons to set up manually. Just build and go.

New in v1.10.0:

  • ig --top N "pattern" — BM25 ranking returns the N most relevant files instead of the first N found on disk. See CLI reference.
  • ig --semantic "error" — PMI-learned query expansion (no ML model, synonyms learned from your repo during indexing). See CLI reference.
  • Auto-compact output when piped to an agent + dir-aggregate ig smart <dir> and ig files. See vs rtk bench: ig now beats rtk on total bytes and total wall time.

Prerequisites

  • Rust toolchain (stable) — rustup toolchain install stable
  • Cargo (comes with Rust)
  • A terminal and a project to search through

Installation

The fastest way to install ig is via the one-line installer. It downloads the latest release binary and auto-configures your AI agents.

# Install latest release + auto-configure AI agents
curl -fsSL https://raw.githubusercontent.com/MakFly/instant-grep/main/install.sh | bash

Or via Homebrew:

brew install MakFly/tap/ig

Or build from source:

# Clone and build
git clone https://github.com/MakFly/instant-grep
cd instant-grep
cargo build --release

# Copy to PATH
cp target/release/ig ~/.local/bin/ig

# Verify
ig --version

Tip: Make sure ~/.local/bin is in your $PATH. Add export PATH="$HOME/.local/bin:$PATH" to your shell config if needed.

Configure AI agents

If you used the one-line installer, agents are already configured. Otherwise run:

# Auto-configure Claude Code, Codex, Gemini CLI...
ig setup

# ig setup does the following:
#  - Installs ig-rewrite.sh hook in ~/.claude/hooks/
#  - Registers the hook in ~/.claude/settings.json
#  - Adds Bash(ig *) permission for Claude Code
#  - Adds search tools section to ~/.claude/CLAUDE.md

Build your first index

Navigate to any project directory and run ig index. This creates a .ig/ directory with binary index files and auto-generated project artifacts.

$ ig index .

* Scanning directory tree
* Skipping 38 excluded directories (node_modules, target, .git, ...)
* Building sparse n-gram index: 1,552 files (SPIMI, 2 segments)
+ Index built in 450ms
   lexicon:  31 MB   (.ig/lexicon.bin)
   postings: 7.1 MB  (.ig/postings.bin)
   metadata: 111 KB  (.ig/metadata.bin)
lexicon.bin
Hash table mapping n-grams to posting list offsets
postings.bin
VByte delta-encoded file ID lists per n-gram
metadata.bin
File paths, modification times, version info

Your first search

Run ig with any regex pattern. If no index exists, it builds one automatically.

Shortcut: ig "pattern" is equivalent to ig search "pattern". The search subcommand is optional.

# Basic search
ig "async fn" src/

# Case-insensitive search
ig -i "TODO" .

# With context lines
ig -C 3 "Result<T>" .

# JSON output for AI agents
ig --json "impl Trait" .

# Filter by file type
ig --type rs "pub fn" .

How auto-build works

When you run ig search, it checks if a .ig/ index exists in the target directory. If not, it automatically runs ig index first. You can always just run search — no manual indexing required.

  1. ig "pattern" . called
  2. Check for .ig/metadata.bin — if missing, build index first
  3. Extract n-grams from regex, query posting lists, verify matches
  4. Results printed in ~0.9ms

Next steps