Appearance
Install OpenAI Codex CLI
Get Codex CLI running on macOS, Windows, or Linux with npm, then sign in and pick a model. For anything that changes fast (flags, model names), always confirm in the official docs. (OpenAI Developer)
Requirements & What You'll Need
Node.js 18+ (for npm installs). (npm)
A terminal (macOS Terminal/iTerm, Windows PowerShell/WSL, or Linux shell).
A way to authenticate:
- Sign in with ChatGPT (Plus/Pro/Team/Edu/Enterprise), recommended, or
- OpenAI API key (Developer Platform). (OpenAI Developer)
Codex runs on macOS, Windows, and Linux. It's the same agent across CLI, IDE, and cloud, with state you can move between. (OpenAI)
Install Codex CLI
npm (global) — recommended
bash
npm i -g @openai/codex
This is the official package; the npm page tracks the latest version. Verify with:
bash
codex --version
(npm)
(If your machine restricts global npm, use nvm/fnm to manage Node and try again.)
First Run & Sign-In
Start Codex:
bash
codex
On first run, it prompts you to authenticate. OpenAI recommends "Sign in with ChatGPT" so Codex uses your ChatGPT plan's included usage. You can alternatively use an API key
Approval Modes (Safety Rails)
Codex can run commands, edit files, and use tools, but it routes potentially risky actions through approvals. You control behavior in the CLI/IDE:
- Auto – fast local edits/commands in your workspace; requests approval for out-of-scope or network actions
- Read Only – inspect, plan, and explain without writing or executing
- Full Access – broadest permissions (use intentionally)
Switch anytime with:
/approvals
OpenAI's update notes and docs highlight this approval flow for CLI/IDE. (OpenAI)
Platform Notes
- macOS & Linux: install via npm, run
codex
, sign in, done. (npm) - Windows: Codex supports Windows directly, and many developers prefer WSL for POSIX tooling; if you hit odd approval prompts on native Windows, community reports suggest WSL behaves more smoothly (anecdotal; not official). (Reddit)
IDE Integration (Nice to Have)
Codex also runs as an IDE extension (e.g., VS Code). You can switch models there and keep the same account/session you use in the CLI. It's the same agent everywhere. (OpenAI Developer)
Quick Verification
- Check the CLI:
bash
codex --version
- In a repo:
bash
codex
> what does this project do?
> where is the main entry point?
> create docs/hello.txt with "Hello from Codex" and show the diff
These are standard discovery/edit tasks shown in Codex quickstart materials. (OpenAI Developer)
Pricing & Plans (Orientation)
Codex is included in ChatGPT Plus/Pro/Team/Edu/Enterprise; you can also use the Developer Platform with an API key (pay-as-you-go). Choose the route that matches your usage/billing needs. (OpenAI)
Sources
- Developers docs (CLI quickstart & auth): getting started,
codex
command, "Sign in with ChatGPT" vs API key. (OpenAI Developer) - Codex product pages: what Codex is, which models and plans apply, model switching to gpt-5-codex. (OpenAI Developer)
- npm package: official
@openai/codex
(install/version). (npm) - Approvals & safety: OpenAI's update post (approval prompts, security modes) and issue discussion for behavior context. (OpenAI)
- Community note (Windows/WSL anecdote): approval prompts on native Windows vs WSL. (Use with caution; not official.) (Reddit)
If you tell me your OS/editor, I'll compress this into a copy-paste checklist tailored to your setup—no fluff, just the exact commands.