Codex CLI crashes with Error: spawn rg ENOENT when ripgrep isn’t installed

Resolved 💬 6 comments Opened Apr 16, 2025 by bjmoonn Closed Apr 16, 2025

When running codex without having rg (ripgrep) on the PATH, the CLI throws an unhandled “spawn rg ENOENT” error and exits.

Ensure ripgrep is not installed or not in your $PATH.

node:events:502
      throw er; // Unhandled 'error' event
      ^

Error: spawn rg ENOENT
    at ChildProcess._handle.onexit (…)
    …
    code: 'ENOENT',
    syscall: 'spawn rg',
    path: 'rg',
    spawnargs: [ '--files' ]
}

The CLI should detect if rg is unavailable and either:

  • Fall back to a bundled file-walk implementation, or
  • Emit a user-friendly error asking to install ripgrep (e.g. “Please install ripgrep (https://github.com/BurntSushi/ripgrep) and ensure rg is on your PATH.”)

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗