Quick Answer: How Do I Download and Install OpenAI Codex in 2026?
On macOS and Linux, install the Codex CLI with one command: curl -fsSL https://chatgpt.com/codex/install.sh | sh. On Windows, run powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex". npm users can run npm install -g @openai/codex, and macOS users can use brew install --cask codex. After installing, run codex in your project folder and sign in with your ChatGPT account — Codex is included with ChatGPT Plus, Pro, Business, Educ, and Enterprise plans, so you do not need a separate subscription to use it. This guide covers every install method, authentication, first run, and what Codex costs on each plan in 2026.
What Is OpenAI Codex in 2026?
Codex is OpenAI’s open-source terminal coding agent. It runs locally on your machine, reads the repository you launch it in, edits files, and runs commands — the same shape as Claude Code or the Cursor CLI. In 2026 Codex is no longer a single tool: it ships across several surfaces, all backed by the same agent and the GPT-5.6 model family:
- Codex CLI — the terminal agent covered in this guide.
- IDE extension — install it directly in VS Code, Cursor, or Windsurf.
- Codex Web — the cloud agent at chatgpt.com/codex, with GitHub code review and Slack integration.
- Desktop and mobile apps — including full app development from your phone (see our Codex Mobile review).
For a wider look at how Codex compares to Cursor, Copilot, and Claude Code, see our best AI coding assistants hub.
Download and Install the Codex CLI
There are four supported ways to get Codex on your machine. Pick whichever fits your workflow — they all install the same agent.
1. Standalone installer (recommended)
The official installer works on macOS and Linux and needs no package manager:
curl -fsSL https://chatgpt.com/codex/install.sh | sh
On Windows, open PowerShell as an administrator and run:
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
The installers download binaries from releases.openai.com/codex by default, falling back to GitHub Releases if a download fails. Re-run the same command to update Codex.
2. npm
Codex ships as an npm package, which is convenient if you already live in the Node ecosystem:
npm install -g @openai/codex
You will want a current LTS release of Node (18+). If codex errors on launch, an outdated Node is usually the cause. If your shell can’t find the command afterward, your npm global bin directory isn’t on PATH — run npm prefix -g and add that folder’s bin to your shell profile.
3. Homebrew (macOS)
brew install --cask codex
Update later with brew upgrade --cask codex. Package and command names change occasionally, so check the official docs if the formula moves.
4. Manual download from GitHub Releases
Every release on github.com/openai/codex includes prebuilt binaries. Grab the one for your platform and rename it to codex after extracting:
| Platform | Binary |
|---|---|
| macOS (Apple Silicon) | codex-aarch64-apple-darwin.tar.gz |
| macOS (Intel) | codex-x86_64-apple-darwin.tar.gz |
| Linux (x86_64) | codex-x86_64-unknown-linux-musl.tar.gz |
| Linux (arm64) | codex-aarch64-unknown-linux-musl.tar.gz |
Verify the install with codex --version before moving on.
Sign In and Authenticate
Launch codex from a project directory. The first time you run it, you choose a sign-in method:
- Sign in with ChatGPT — opens a browser for the ChatGPT OAuth flow. This uses the Codex usage included in your ChatGPT Plus, Pro, Business, Educ, or Enterprise plan, so no separate billing.
- API key — authenticate with an OpenAI API key that bills at standard API rates. This is the right choice for CI jobs, scripts, and any non-interactive run where a browser flow isn’t possible:
export OPENAI_API_KEY="sk-..." printenv OPENAI_API_KEY | codex login --with-api-key
Either way, credentials are cached at ~/.codex/auth.json (or your OS credential store). Treat that file like a password — never commit it or paste it into a chat. You can check authentication status in scripts with codex login status, which exits 0 when credentials are present, and sign out on shared machines with /logout.
First Run: Permissions and Sandboxing
Codex reads the directory you launch it in, so always start it from the repository root. On the first interactive run it asks how much autonomy to grant — whether it can run commands and edit files on its own or must ask first. Start conservative: let it propose a small change, watch how it edits and what commands it wants to run, then loosen the leash once you trust its judgment. You can change the boundaries mid-session with /permissions.
For low-friction local work, the recommended profile is:
codex --sandbox workspace-write --ask-for-approval on-request
Codex also connects to external tools via MCP (codex mcp) so you can add local or remote servers, authenticate when needed, and inspect available tools before the agent uses them. GitHub integration adds curated flows for triaging PRs, issues, and CI.
What Does Codex Cost in 2026?
The headline change of 2026: Codex is included in every paid ChatGPT plan — you no longer buy it separately except through usage-priced Codex-only seats or an API key. Usage limits are message-based and shared between local and cloud tasks within a five-hour rolling window.
| Plan | Price | Codex access |
|---|---|---|
| ChatGPT Plus | $20/mo | Included; roughly 15–90 GPT-5.6 Sol local messages per 5-hour window |
| ChatGPT Pro | $100–$200/mo | 5x–20x Plus usage, plus GPT-5.3-Codex-Spark (research preview) |
| ChatGPT Business | $20/seat/mo | Per-seat included limits (same as Plus) on web, CLI, IDE, and iOS |
| Enterprise / Edu | Contract | No fixed rate limits on flexible pricing; usage scales with credits |
| API key | Usage-based | All models billed on token consumption |
Two pricing notes worth flagging:
- OpenAI previously let Business workspaces add Codex-only pay-as-you-go seats at no fixed fee, billed purely on tokens. As of June 24, 2026, new pay-as-you-go Codex-only seats are no longer sold for Business plans — existing seats are unaffected. Teams that want broad ChatGPT access should just use standard Business seats, which include Codex limits.
- Eligible Business workspaces could claim $100 in credits per new Codex team member (up to $500 per team) during the promo window.
Which model you use matters for limits: GPT-5.6 Sol is the balanced default, GPT-5.6 Luna gives far higher per-window message counts for lighter workloads, and GPT-5.6 Terra is used for heavier reasoning. Note that GPT-5.4 and GPT-5.4 mini retire in Codex for ChatGPT sign-ins on August 31, 2026 — switch to GPT-5.6 Terra and Luna. For a deep dive on the flagship model, see our GPT-5.6 Sol review.
Pro Tips for a Clean Setup
- Wire up a notify hook. Codex can run an external command at the end of a turn via the
notifykey in~/.codex/config.toml— that turns Codex from something you babysit into something that pings you when a long task finishes. - Watch your usage. Limits and remaining credits are visible under Codex settings › Usage. Plus and Pro users who hit a limit can buy additional credits without upgrading; Business and Enterprise workspaces with flexible pricing can buy workspace credits.
- Persist configuration. Set your default model and provider in
config.tomlso every run uses the same setup instead of re-choosing flags. - Keep credentials local. Never commit
~/.codex/auth.json, and use/logoutbefore handing a machine to someone else.
Frequently Asked Questions
Is OpenAI Codex free in 2026?
Codex is included in qualifying ChatGPT plans, including Free (limited), Plus at $20/month, Pro, Business, Enterprise, and Educ. There is no separate download fee — you install the CLI and sign in with your existing ChatGPT account.
How do I download Codex CLI?
macOS/Linux: curl -fsSL https://chatgpt.com/codex/install.sh | sh. Windows: powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex". npm: npm install -g @openai/codex. Homebrew: brew install --cask codex.
Can I use Codex without a ChatGPT subscription?
Yes — authenticate with an OpenAI API key instead. Codex bills usage at standard API rates in that mode, which suits CI jobs and scripted runs. You can also use Codex from the cloud on ChatGPT Free and Go plans with limited usage.
Does Codex work on Windows?
Yes. Use the PowerShell installer (irm https://chatgpt.com/codex/install.ps1 | iex) or install the npm package globally.
Which Codex model should I pick?
GPT-5.6 Sol for balanced day-to-day work, GPT-5.6 Luna for high-volume lighter tasks (higher per-window limits), and GPT-5.6 Terra for heavy reasoning. GPT-5.4 models retire in Codex for ChatGPT sign-ins on August 31, 2026; Pro users can try GPT-5.3-Codex-Spark in research preview.
