Skip to main content
The completion command generates shell completion scripts that enable tab-completion for Codex commands, subcommands, and flags.

Usage

Supported Shells

  • bash (default)
  • zsh
  • fish
  • powershell
  • elvish

Installation

Bash

Add to your ~/.bashrc:
Or generate to a file:

Zsh

Add to your ~/.zshrc:
Or generate to a file:
Make sure ~/.zsh/completions is in your $fpath:

Fish

Generate to Fish’s completions directory:

PowerShell

Add to your PowerShell profile:

Examples

Generate Bash Completions

Generate for Specific Shell

Save to File

What Gets Completed

Shell completion works for:
  • Commands: codex <TAB> shows all available commands
  • Subcommands: codex mcp <TAB> shows MCP subcommands
  • Flags: codex --<TAB> shows all global flags
  • Options: codex -m <TAB> suggests model names

Troubleshooting

Completions Not Working

  1. Make sure you’ve reloaded your shell:
  2. Verify the completion file is in the right location:
  3. Check that the completion function is loaded:

codex

Main Codex CLI command