The full guide
Install Codex CLI, step by step
Codex CLI is OpenAI's coding agent for the terminal, one program called codex. The commands above install it; this part covers what the installer leaves on your machine and how to remove it.
What the installer does
The standalone script downloads the release for your system from OpenAI, falls back to GitHub Releases, and puts codex in ~/.local/bin (on Windows, %LOCALAPPDATA%\Programs\OpenAI\Codex\bin). It adds that folder to your shell profile (on Windows, your user PATH), which is why a new terminal finds it and the old one does not. Run the same command later and it updates in place.
On macOS and Linux, if it finds a copy you installed with npm, Homebrew or bun, it offers to remove it. Keep one: with two installed, whichever folder comes first on your PATH wins, and codex --version can report a version you did not just install.
Where Codex keeps its files
Everything lives in ~/.codex, or in the folder CODEX_HOME names. That folder must exist before you point CODEX_HOME at it.
| Path | What it holds |
|---|---|
config.toml | settings: model, approvals, sandbox, MCP servers |
auth.json | your login, unless it is kept in the OS keychain |
sessions/ | every conversation, one file per session, by date |
archived_sessions/ | sessions you archived |
A project can override settings with its own .codex/config.toml, read only once you trust the project.
Update or remove it
| Installed with | Update | Uninstall |
|---|---|---|
| Standalone installer | run it again, or codex update | delete ~/.local/bin/codex and ~/.codex/packages/standalone |
| Homebrew | brew upgrade --cask codex | brew uninstall --cask codex |
| npm | npm install -g @openai/codex | npm uninstall -g @openai/codex |
Removing the program leaves ~/.codex with your settings, login and history. Delete it only if you want them gone.
Where your sessions go
Codex writes every session to ~/.codex/sessions/ as JSON lines, with the tokens of each turn. Caprock reads that folder, and archived_sessions/, honouring CODEX_HOME, and shows each Codex session live next to your Claude Code ones, whichever terminal started it, priced at OpenAI's list rates — an estimate, not a bill. Its Cost screen also shows Codex's plan windows (5-hour and weekly, where your plan has them) as Codex last recorded them. What each plan includes, and what a session costs, is in Codex pricing and usage; how Codex compares with Anthropic's agent is in Codex vs Claude Code.
Questions people ask
- How do I install Codex CLI?
- On macOS or Linux run curl -fsSL https://chatgpt.com/codex/install.sh | sh. On Windows run OpenAI's PowerShell installer. npm install -g @openai/codex and brew install --cask codex work too.
- Does Codex CLI work on Windows?
- Yes, natively. OpenAI recommends native Windows with Codex's own sandbox, on Windows 11 or Windows 10 1809 and later, and WSL 2 when your tools live in Linux. WSL 1 is not supported since Codex 0.115.
- Is Codex CLI free?
- The program is free and open source. Using it needs a ChatGPT plan that includes Codex, Plus being the first that lists the CLI, or an OpenAI API key billed per token.
- How do I update Codex CLI?
- Run the install command again, or codex update. Homebrew installs update with brew upgrade --cask codex, and npm installs with npm install -g @openai/codex.
- How do I uninstall Codex CLI?
- npm uninstall -g @openai/codex or brew uninstall --cask codex. For the standalone install, delete ~/.local/bin/codex and ~/.codex/packages/standalone. Settings, logins and sessions stay in ~/.codex until you delete it.
Sources
- OpenAI Codex docs — Codex CLI (install), read 4 October 2026
- OpenAI Codex docs — Authentication, read 4 October 2026
- OpenAI Codex docs — Windows sandbox, read 4 October 2026
- OpenAI Codex docs — Codex in WSL, read 4 October 2026
- OpenAI Codex docs — Troubleshooting, read 4 October 2026
- OpenAI Codex docs — Config basics, read 4 October 2026
- OpenAI Codex docs — Pricing, read 4 October 2026
- openai/codex README and install docs (system requirements, binaries)
- openai/codex releases — rust-v0.160.0, 1 October 2026
- Caprock source — reading Codex sessions from CODEX_HOME
Try it
The record of every coding agent you run, the sessions it did not start included. Free, open source; nothing leaves your machine.
Notarized by Apple. One file for Apple silicon and Intel, macOS 13 or later.
Or run it yourself:
Paste in Terminal: it installs Caprock and opens it.Or with Homebrew: brew install --cask dspv/tap/caprock-app