Skip to content

How to set up Codex CLI

Open in ChatGPT ↗
Ask ChatGPT about this page
Open in Claude ↗
Ask Claude about this page
Copied!

Set up OpenAI's Codex CLI in Warp, configure it for your project, and learn productivity tips for faster AI-assisted coding workflows in Warp.

Codex CLI is OpenAI’s open-source coding agent. It reads your codebase, edits files, and executes commands from natural language prompts. This guide takes you from installation to a working Codex session in Warp in about 5 minutes, then shows you how to get the most out of it.

  • A ChatGPT account with Codex access — Included with paid ChatGPT plans, or use an OpenAI API key. See Codex CLI documentation for eligible plans.
  • Node.js 18+ (for npm install) or Homebrew (for macOS) — Choose your preferred package manager.
  • macOS or Linux — Windows support is experimental; for the best Windows experience, use Codex in a WSL workspace.

Install Codex CLI globally with npm or Homebrew:

npm:

Terminal window
npm install -g @openai/codex

Homebrew (macOS):

Terminal window
brew install codex

Verify installation:

Terminal window
codex --version

You can also download platform-specific binaries directly from the GitHub releases.

Run Codex for the first time:

Terminal window
codex

Select Sign in with ChatGPT and authenticate with your ChatGPT account (recommended). Your Codex usage is included in your ChatGPT plan.

For API key authentication (useful for CI/CD or automation):

Terminal window
export OPENAI_API_KEY=YOUR_API_KEY

Navigate to a project directory and launch Codex:

Terminal window
cd ~/your-project
codex

Codex starts an interactive terminal session. Try giving it a task, for example:

Explain the structure of this project

Or something more hands-on:

Add error handling to the database connection module

Codex will read the relevant files, propose changes, and ask for your confirmation before modifying anything. You can review changes in a diff view and accept or reject each one.

Switch between available models during a session with the /model command. See Codex CLI documentation for the current model list.

Codex has three approval modes that control how much autonomy it has.

  • Auto (the default) lets Codex read, edit, and run commands within your working directory but asks before anything outside that scope.
  • Read-only keeps Codex consultative
  • Full Access grants broader autonomy including network access.

Use /permissions inside a session to switch modes as your comfort level changes.

Create a codex.md or AGENTS.md file at your project root to teach Codex your project’s conventions:

# My Project
## Stack
- Backend: Node.js, Express, TypeScript
- Database: PostgreSQL with Prisma ORM
- Testing: Vitest for unit tests, Playwright for e2e
## Conventions
- Use ESM imports (no require())
- All API endpoints need Zod input validation
- Run `npm test` before committing

Codex reads this file at the start of every session and follows your conventions automatically.

  • Use voice to prompt Codex — Dictate complex instructions instead of typing them. Warp supports voice transcription that works with any CLI agent, including Codex.
  • Attach images as context — Paste screenshots of bugs, designs, or error messages into your prompt. Warp’s images as context feature lets Codex see what you see.
  • Review diffs visually — After Codex makes changes, open Warp’s Code Review panel (⌘+Shift++) to see a visual diff. You can leave inline comments and send them back to Codex for corrections.
  • Run Codex alongside Claude Code — Use vertical tabs to run Claude Code and Codex side by side on the same task. Compare their approaches and pick the best output, or combine elements from both.
  • Compose richer prompts — Press Ctrl+G to open Warp’s rich input editor for Codex, giving you a full text editor experience instead of raw CLI input.

You installed Codex CLI, authenticated, started your first session, and configured it for your project. Codex is now set up as a working AI coding agent in Warp.

Explore related guides and features: