Codex CLI
Codex CLI is OpenAI’s coding agent that you can run locally from your terminal. It can read, change, and run code on your machine in the selected directory.
For more information, visit the Codex CLI documentation.
-
Install the Codex CLI.
Terminal window npm i -g @openai/codexTerminal window brew install codex -
Verify installation.
Terminal window codex --version -
Run Codex to start an interactive Terminal UI session (TUI). Codex can inspect your repository, edit files, and run commands.
Terminal window codexThe first time you run Codex, you’ll be prompted to sign in. Authenticate with your ChatGPT account or an API key.
-
Slash commands give you fast, keyboard-first control over Codex.
Type
/to open the slash popup, choose a command, and Codex will perform actions such as switching models, adjusting permissions, or summarizing long conversations without leaving the terminal.For example, use
/modelto switch between available models.For more slash commands, visit Codex CLI Slash Commands documentation.
-
Upgrade
New versions of the Codex CLI are released regularly. To upgrade:
Terminal window npm i -g @openai/codexTerminal window brew upgrade codex