CLI – Codex | OpenAI Developers
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. It’s open source and built in Rust for speed and efficiency.
ChatGPT Plus, Pro, Business, Edu, and Enterprise plans include Codex. Learn more about what’s included.
CLI setup
Choose your install option
macOS/LinuxWindowsnpmHomebrew
- 1
Install
Install the Codex CLI with the standalone installer for macOS and Linux.
macOS/Linux install command
curl -fsSL https://chatgpt.com/codex/install.sh | shCopy
For unattended installs, set CODEX_NON_INTERACTIVE=1 on the shell that runs the downloaded installer. See Environment variables for details.
macOS/Linux unattended install command
curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 shCopy
- 2
Run
Run Codex in a terminal. It can inspect your repository, edit files, and run commands.
Run Codex command
codexCopy
The first time you run Codex, you'll be prompted to sign in. Authenticate with your ChatGPT account or an API key.
See the pricing page if you're not sure which plans include Codex access.
- 3
Upgrade
New versions of the Codex CLI are released regularly. See the changelog for release notes. To upgrade a standalone install, rerun the installer:
macOS/Linux upgrade command
curl -fsSL https://chatgpt.com/codex/install.sh | shCopy
The Codex CLI is available on macOS, Windows, and Linux. On Windows, run Codex natively in PowerShell with the Windows sandbox, or use WSL2 when you need a Linux-native environment. For setup details, see the Windows setup guide.
If you’re new to Codex, read the best practices guide.