Getting started with OpenAI Codex
Install Codex and choose between its CLI, IDE, desktop, and cloud surfaces.
OpenAI Codex is a coding agent available through a terminal CLI, IDE extension, desktop app, cloud tasks, and SDK. The same project can move between those surfaces, but execution location and security boundaries differ.
Official starting points: Codex overview, CLI, IDE extension, and Codex app.
Install and sign in
npm install --global @openai/codex
codex login
codexOpenAI also publishes standalone installers:
curl -fsSL https://chatgpt.com/codex/install.sh | shOn Windows, follow the current installer on the CLI page rather than translating the Unix command.
Pick the right surface
| Surface | Best fit |
|---|---|
| CLI | Local repository work, scripts, CI, and precise sandbox controls. |
| IDE extension | Editing in VS Code, Cursor, Windsurf, or supported JetBrains IDEs with inline context and diffs. |
| Desktop app | Multiple Local, Worktree, and Cloud threads; browser/computer use; automations; integrated Git review. |
| Cloud | Background tasks in isolated OpenAI-managed containers connected to GitHub. |
The desktop app can launch from a terminal:
codex app .First local task
Start with workspace-only writes and approval when Codex needs to cross the configured boundary:
codex --sandbox workspace-write --ask-for-approval on-requestThen ask:
Read AGENTS.md and the main package or project files. Explain how to install,
run, and test this repository. Do not edit anything yet.For one non-interactive task:
codex exec --sandbox workspace-write \
"Run the main test suite, diagnose failures, and make the smallest fix."Feature maturity matters
OpenAI labels Codex capabilities as Stable, Beta, or Experimental. Stable
features are intended for production use; Experimental features can change or
be removed. Check the live
feature-maturity page
before making an exercise depend on a newer command. For example, the cloud
service is current while some codex cloud CLI commands may still be marked
Experimental.
Where configuration lives
User defaults live in ~/.codex/config.toml; a repository can add trusted
project configuration under .codex/config.toml. Keep durable coding
instructions in AGENTS.md, not in an ever-growing config file.