1. Install
Pick one method.
macOS or Linux: standalone installer
curl -fsSL https://chatgpt.com/codex/install.sh | sh
Windows: standalone installer
Start a new PowerShell window, then run:
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
npm (any OS with Node.js)
npm install -g @openai/codex
Homebrew (macOS)
brew install --cask codex
According to the README, the standalone installers download from releases.openai.com/codex and fall back to GitHub Releases if that’s unavailable. To force GitHub Releases:
curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_INSTALLER_USE_RELEASES_OPENAI_COM=false sh
2. Confirm it installed
Open a new terminal so your PATH refreshes, then run:
codex --version
You should see a version number. If you see “command not found”, follow this fix.
3. Sign in
Go to a project folder and start Codex:
cd path/to/your/project
codex
Choose Sign in with ChatGPT. Your browser opens, and after you sign in it hands the credentials back to the CLI. You can also run codex login directly. To use an API key instead:
printenv OPENAI_API_KEY | codex login --with-api-key
Check which method is active with codex login status. Working over SSH or on a headless server? Use codex login --device-auth. More sign-in options.
4. Run a first prompt
Tell me about this project
Then continue with your first real task.
Useful commands to know
| Command | What it does |
|---|---|
codex | Start an interactive session in the current folder |
codex resume | Reopen a recent chat from this repository |
codex exec "..." | Run non-interactively, for scripts and CI |
codex --search | Use live web search for this run |
codex mcp add ... | Connect an MCP server |
codex login status | Show the active sign-in method |
codex completion | Generate shell completions |