completion command generates shell completion scripts that enable tab-completion for Codex commands, subcommands, and flags.
Usage
Supported Shells
bash(default)zshfishpowershellelvish
Installation
Bash
Add to your~/.bashrc:
Zsh
Add to your~/.zshrc:
~/.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
-
Make sure you’ve reloaded your shell:
-
Verify the completion file is in the right location:
-
Check that the completion function is loaded:
Related Commands
codex
Main Codex CLI command