Codex: Beginner
Codex is OpenAI’s agentic coding agent. It runs in your terminal and your IDE, reads and edits files in your project, runs commands in a sandbox, and works through multi-step tasks, pausing for your approval along the way. It ships as a CLI, an IDE extension, and a cloud service that all share one backend. This guide gets you from install to a productive first task. For the bigger picture, see How AI coding tools work.
What you need
Section titled “What you need”- A terminal, or VS Code, Cursor, Windsurf, or a JetBrains IDE for the extension
- Node.js (for the CLI install via npm), or Homebrew on macOS
- A ChatGPT plan (Plus, Pro, Business, Edu, or Enterprise; Free and Go work at low limits) or an OpenAI API key
Install
Section titled “Install”-
Install the Codex CLI (or the IDE extension):
Terminal window npm install -g @openai/codexTerminal window brew install codexInstall the Codex extension from the VS Code, Cursor, Windsurf, or JetBrains marketplace.
-
Go to a project and start it:
Terminal window cd my-projectcodex -
On first run, sign in with your ChatGPT account or paste an API key.
Your first task
Section titled “Your first task”Talk to it in plain English. A few good first prompts:
What does this project do? Give me a short overview.Find where the page title is set and change it to "Hello".Codex explores the files, shows the edits it plans to make, runs any commands in a sandbox, and asks for approval before it changes anything.
Approvals and the sandbox
Section titled “Approvals and the sandbox”Codex doesn’t edit files or run commands behind your back. Two controls decide how much freedom it has:
- Approval mode: how often it stops to ask.
- The sandbox: an OS-level boundary (macOS Seatbelt, a Linux sandbox, or the native Windows sandbox / WSL2) that limits what a command can touch.
| Approval mode | What it does |
|---|---|
| Auto (default) | Edits inside the workspace and asks before anything riskier |
| Read-only | Looks but doesn’t change files or run commands |
| Full Access | Acts without stopping to ask |
Switch mode at any time with /permissions.
The commands you’ll use first
Section titled “The commands you’ll use first”| Command | What it does |
|---|---|
/init | Draft a starter AGENTS.md so Codex knows your project |
/permissions | Switch approval mode mid-session |
codex resume | Continue your previous session |
You’re done when…
Section titled “You’re done when…”- ✅ You can start Codex in a project (CLI or IDE)
- ✅ You’ve approved at least one file change
- ✅ You know how to switch approval modes and resume a session
Next step
Section titled “Next step”Ready for a real workflow: a steering file, the right context, and the window that limits it all?