In 2026, OpenAI redefined Codex from its historical role as a code-completion model into a full programming agent platform: the Codex CLI runs in your local terminal, reads repos, edits files, and executes commands; GPT-5.5-Codex is the software-engineering model variant tuned for that work. This article is the English site's authoritative install + usage landing page — covering three install methods, ChatGPT login, config.toml, approval sandboxing, /model switching, and your first acceptance-ready task. If you are still weighing how Codex relates to Claude Code and Cursor, the structured comparison and scenario matrix below will help.
1. Why install Codex CLI separately in 2026?
ChatGPT on the web can write code, but engineering teams face a real gap: suggestions in a chat window do not automatically become auditable git diffs; they cannot reliably run test loops; they cannot plug into CI. Codex CLI solves the execution boundary — it puts the GPT-5.5 family inside a directory you choose and lets the agent edit files and run shell commands under sandbox and approval policies.
Unlike the 2021 “Codex completion API,” 2026 Codex is an open-source terminal agent written in Rust (repo: openai/codex), tied to ChatGPT subscriptions, and extended to IDE extensions, a desktop app, and Codex Cloud async jobs. The real dividing line is not “OpenAI vs Anthropic who is stronger” — it is whether you are willing to delegate tasks to a terminal agent.
2. How to classify Codex's four entry points
This install guide focuses on Codex CLI, but the full platform has four surfaces sharing the ~/.codex/ config directory:
| Entry point | Form factor | Best for | Typical use |
|---|---|---|---|
| Codex CLI | Terminal TUI + codex exec |
Shell-first developers who want scripting | Refactors, test-fix loops, headless CI tasks |
| IDE extension | VS Code / Cursor / Windsurf plugin | Developers who want diffs inside the editor | Write-and-delegate, localized multi-file edits |
| Codex App | macOS / Windows desktop | People who prefer not to memorize terminal commands | Visual approvals, Cloud task management |
| Codex Cloud | chatgpt.com/codex async agent | Long tasks, isolated environments | Large-repo exploration, PR-scale changes (GitHub required) |
The main path in this article is CLI first: once the CLI works, IDE extensions and the App usually need only the same account login to reuse your configuration.
3. Core comparison: Codex vs Claude Code vs Cursor
Plain-language pricing first: all three start around $20/month, but you are not buying the same thing —
- Codex and Claude Code: like a mobile data plan — allowance resets every few hours; asking AI to edit many files in one session burns through quota fast.
- Cursor: like a gym membership — a fixed $20/month, best value if you live in the IDE eight hours a day, and the easiest bill to predict.
The green-highlighted column in the table below is about how you are charged and whether month-end bills surprise you — that is what matters most when choosing a tool. Capability differences sit in the left columns; pricing behavior is in the green column.
| Tool | Entry · execution · context | Price (2026) | How billing works · predictable? | Best for |
|---|---|---|---|---|
| Codex CLI | Terminal agent edits code and runs commands · Codex Cloud async tasks · repo + MCP | Free: trial, limited $20/mo: included with ChatGPT Plus $100 / $200: heavy daily use Enterprise plans separate |
How billing works
Tied to ChatGPT membership, like data that refreshes every ~5 hours Already paying for ChatGPT → Codex costs nothing extra Predictable? Medium — great for existing subscribers; new Plus signups should count $20 in total cost |
Already on ChatGPT Want GPT-5.5-Codex Occasionally offload review to Cloud |
| Claude Code | Terminal agent edits code and runs tests · GitHub auto-fix · long context | Free tier: no Claude Code $20/mo: included with Claude Pro $100 / $200: full-day AI delegation Enterprise per seat |
How billing works
Tied to Claude membership, also a few-hour refresh data-style quota One session editing dozens of files → quota gone fast Predictable? Lower — big tasks feel like burst usage; weekly quota can vanish unexpectedly |
Company on Anthropic Long autonomous edits CI auto-fix on PRs |
| Cursor | In-editor coding, Tab completion, click-to-accept AI edits · multi-model | Free: limited $20/mo: mainstream solo dev tier Teams $40/seat/mo Higher tiers for extreme usage |
How billing works
Fixed $20/month, like a membership card Quota exhausted → slower or pay more, but daily coding usually fits Predictable? Best — fixed monthly cost, ideal for “8 hours a day in the IDE” |
Cannot live without Tab completion Want click-to-review diffs Need predictable month-end bills |
One-line pricing pick: already on ChatGPT → use Codex at no extra cost; already on Claude → use Claude Code; starting from zero and need completion daily → Cursor $20 is simplest. Want both? Cursor + ChatGPT Plus ≈ $40/month beats jumping straight to $100 heavy tiers. Check official pricing for current numbers.
For a deeper IDE comparison see Claude Code vs Cursor 2026; for the Anthropic vs OpenAI agent narrative see the Claude Code era.
4. How to choose by scenario
| If you are… | Choose… | Why |
|---|---|---|
| Budget-conscious, want one fixed monthly charge | Cursor $20/mo | Like a gym membership — best daily-coding value, most predictable bill |
| Already paying for ChatGPT | Codex (no extra purchase) | Included with Plus — programming agent bundled with your subscription |
| Company standardizes on Anthropic, CI wired to claude-code-action | Claude Code | Permissions, Actions, and CLAUDE.md ecosystem already aligned |
| Long tasks, do not want to tie up a local terminal | Codex Cloud + CLI to pull diffs | Async execution; review results locally |
| Need MCP for GitHub issues + code graph | Codex MCP or Claude Code MCP triple-connect | Pick MCP host by primary agent; tool protocols are reusable |
5. Recommended stacks (2026 engineering)
- Solo developer — Codex CLI (GPT-5.5-Codex) + your existing IDE for small edits; open
codexon weekends for larger delegated tasks. - Full-stack + iOS — business code locally with Codex/Cursor; Xcode builds and signing on Cloud Mac or a GitHub Runner execution node.
- Team CI —
codex execor Codex Cloud produces patches → Actions compile and test → humans review PRs. Isolate runners with one job, one workspace. - Knowledge-dense repos — Codex MCP for issue tracking + optional CodeGraph; rules in project
.codex/config.tomlandAGENTS.md.
6. Before you install
- Account — ChatGPT Plus / Pro / Business / Edu / Enterprise (includes Codex), or a working OpenAI API Key.
- OS — macOS and Linux are first-class; Windows via native PowerShell or WSL2.
- Git repo — validate in a real project root, not an empty folder.
- Node.js 18+ — required only for
npm install -g @openai/codex.
uname -a git --version node -v # check if using npm path which codex # should be empty before install
7. Three install methods (2026 official paths)
| Method | Command | Best for |
|---|---|---|
| Official script (recommended) | curl -fsSL https://chatgpt.com/codex/install.sh | sh | Fastest on macOS / Linux |
| npm global | npm install -g @openai/codex | Environments with Node toolchain already |
| Homebrew | brew install --cask codex | macOS package-manager preference |
| Windows PowerShell | irm https://chatgpt.com/codex/install.ps1 | iex | Native Windows + sandbox |
# for non-interactive CI images, set first export CODEX_NON_INTERACTIVE=1 curl -fsSL https://chatgpt.com/codex/install.sh | sh codex --version
npm install -g @openai/codex@latest codex --version # on EACCES: npm config set prefix ~/.npm-global, add ~/.npm-global/bin to PATH
First acceptance check after install
Run codex --version anywhere for a version string; in a test repo run codex "list files in the current directory" — a file list means binary and network are fine. An auth prompt before login is expected.
8. Login and authentication
First run of codex opens the interactive TUI. Choose:
- Sign in with ChatGPT (recommended) — browser OAuth; usage counts against your ChatGPT plan.
- API Key — for automation and per-token accounting; never commit keys to git.
Config and credentials live in ~/.codex/. On shared machines watch file permissions; in CI inject API keys via a secrets manager, not the repository.
9. GPT-5.5-Codex: model switching and config.toml
GPT-5.5 is the general flagship; GPT-5.5-Codex is optimized for code tasks (read repos, apply patches, tool-chain reasoning). Default to the Codex variant for software engineering; switch back to gpt-5.5 for general Q&A.
In-session switch: in the TUI type /model, select gpt-5.5-codex, and adjust reasoning level.
Persistent default: edit user config ~/.codex/config.toml (project-level .codex/config.toml requires trusting that project):
# default programming model model = "gpt-5.5-codex" # approval: on-request = ask when agent needs elevated access (recommended) approval_policy = "on-request" # sandbox: start read-only, widen to workspace-write after you trust the flow sandbox_mode = "read-only" # reasoning effort (tune per task) model_reasoning_effort = "medium"
Config precedence (later overrides earlier): built-in defaults → ~/.codex/config.toml → project .codex/config.toml → Profile (codex --profile ci) → CLI flags. See official Config basics.
10. Daily use: TUI, approvals, MCP, and scripting
Interactive mode
cd your-repo codex # or a one-line task codex "run npm test and fix failing cases; do not change package-lock"
Approval modes (safety baseline)
| approval_policy | Behavior | When to use |
|---|---|---|
on-request | Auto inside sandbox; asks when escalating | Default recommended |
untrusted | Only auto-allows known safe read-only commands | Production repos, conservative stance |
never | No prompts (failures return to model) | Isolated sandbox CI only — not daily local use |
For rm, production config changes, or secret files, always approve manually. Enterprise setups may block never or danger-full-access sandbox via requirements.toml.
MCP extensions
Codex supports the Model Context Protocol. Declare MCP servers in config.toml to pull GitHub, databases, and other external context. Configuration philosophy is similar to Claude Code — different host — see our MCP setup guide for PAT least-privilege principles.
Scripted exec and Cloud
codex exec "..."— headless execution for cron / CI pre-checks.- Subagents — split large tasks into parallel child agents (enable in TUI).
- Local code review — independent agent reviews diffs before commit.
- Codex Cloud — launch cloud tasks from terminal, pull patches, apply locally.
11. Common mistakes
- Treating Codex like ChatGPT on the web — without CLI install and diff review, you never close the engineering loop.
- Starting with sandbox_mode = danger-full-access — saves clicks but accidental deletes are irreversible; begin read-only, then widen.
- Launching codex in a subdirectory — the agent only sees cwd context; in monorepos start at the correct package root.
- Ignoring Windows path differences — native PowerShell and WSL repo paths are not the same filesystem; pick one path and stick to it.
- Comparing models but not entry points — GPT-5.5-Codex is strong, but if you need Tab completion, prefer Cursor + Codex extension over forcing pure TUI.
12. 7-step rollout checklist
- Install CLI — run official
install.shornpm i -g @openai/codex; verifycodex --version. - Sign in — ChatGPT OAuth or API Key; confirm
~/.codex/was created. - Write config.toml —
model = "gpt-5.5-codex",approval_policy = "on-request",sandbox_mode = "read-only". - Pick a repo —
cdinto a familiar mid-size project;git statusclean or on a feature branch. - Smoke task —
codex "explain src directory structure and draw a tree"; verify it reads the right files. - Closed-loop task —
codex "run tests with [your test cmd] and fix failures"; confirm it actually runs shell. - Wire team stack — for 24/7 builds put runners on Cloud Mac; add MCP when you need a code graph.
13. FAQ
Which is cheapest — Codex, Claude Code, or Cursor?
All start around $20/month on paper — there is no universal “cheapest.” If you already pay for ChatGPT, Codex is effectively included; same for Claude Pro and Claude Code. Starting from zero and wanting one predictable monthly charge, Cursor is easiest to estimate. Heavy usage where AI edits many files at once may push either side to $100–$200 — see the comparison table above.
Does Codex cost extra?
Usually not. ChatGPT Plus ($20/month) includes Codex. You can also use your own API Key and pay per token, but you lose member-only features like cloud code review. See OpenAI's Codex in ChatGPT article for current limits.
What is the difference between GPT-5.5 and GPT-5.5-Codex?
GPT-5.5 is general-purpose; GPT-5.5-Codex is fine-tuned for software engineering — better at reading code, writing patches, and following tool chains. Default to the Codex variant for coding.
Can I install Codex and Claude Code together?
Yes. Config directories differ (~/.codex/ vs ~/.claude.json); use each per scenario in the same repo. Align formatting rules so two agents do not fight over style.
command not found after install?
Restart your shell or add the install path to PATH. Homebrew users check /opt/homebrew/bin; npm users check ~/.npm-global/bin.
How do I upgrade Codex?
npm install -g @openai/codex@latest or re-run the official install script; Homebrew: brew upgrade codex.
14. Summary
A 2026 Codex install guide is really about wiring OpenAI's programming agent to your filesystem and terminal. Three commands install the CLI; sign in with ChatGPT; default to gpt-5.5-codex in config.toml with on-request approvals as your safety line — and you have a reproducible, scriptable, Cloud-ready coding workflow. Codex competes with Claude Code for the terminal-agent entry point and with Cursor for who drives daily coding; most teams end up dual- or triple-wielding rather than betting on one brand.
For readers who need real macOS builds: no matter how fast the agent writes code, Xcode and runners still need Apple hardware. Cloud Mac pairs with local Codex edits and remote compile — split “write” from “verify” and shorten your path to release.
ZavCloud · Cloud Mac
Codex edits fast — iOS builds still need real macOS
Dedicated Mac mini M4: native Xcode, static IP, GitHub Actions runners on the same machine or network segment as Codex — so terminal-agent diffs go green on auditable compute.
View Cloud Mac plans