Primary navigation

Codex CLI

Pair with Codex in your terminal.

npm i -g @openai/codex

Included with ChatGPT Plus, Pro, Business, Edu, and Enterprise plans.

Codex CLI terminal preview.
$ codex
╭──────────────────────────────────────────────────╮
│ >_ OpenAI Codex                                  │
│                                                  │
│ model:     gpt-5-codex medium   /model to change │
│ directory: ~/code                                │
╰──────────────────────────────────────────────────╯

  To get started, describe a task or try one of these commands:

  /init - create an AGENTS.md file with instructions for Codex
  /status - show current session configuration
  /approvals - choose what Codex can do without approval
  /model - choose what model and reasoning effort to use
  /review - review any changes and find issues
      

 Refactor the Dashboard component to React Hooks
      
  100% context left · ? for shortcuts
      

Codex CLI is a coding agent that you can run locally from your terminal and that can read, modify, and run code on your machine, in the chosen directory. It’s open source, built in Rust for speed and efficiency, and rapidly improving at openai/codex on GitHub.

Get started with the Codex CLI

Choose your package manager
  1. 1

    Install the CLI

    Grab the Codex CLI with npm. Use the tabs above if you prefer a different package manager.

    npm install command
    npm i -g @openai/codex

    The Codex CLI officially supports macOS and Linux. Windows support is still experimental — we recommend running in WSL. See the Windows setup guide for step-by-step instructions.

  2. 2

    Launch Codex

    Open the interactive terminal UI and let Codex inspect your repo, edit files, and run commands alongside you.

    codex

    The first launch prompts you to authenticate. Sign in with your ChatGPT Plus, Pro, Business, Edu, or Enterprise account for the quickest setup, or provide an API key if you need fine-grained control.

    Check the pricing page if you are unsure which plans include Codex access.

  3. 3

    Stay up to date

    Codex releases regularly new versions of the CLI. Check out the changelog for the latest release. To upgrade with npm run:

    npm upgrade command
    npm i -g @openai/codex@latest

Working with the Codex CLI

Run Codex interactively

To pair with Codex in your terminal, run codex to start up an interactive terminal UI (TUI) session.

Control model & reasoning

Switch between GPT-5-Codex and GPT-5 or adjust reasoning levels with /model whenever you need deeper analysis.

Image inputs

Attach screenshots or design specs so Codex reads them alongside your prompt.

Run local code review

Get your code reviewed by a separate Codex agent before you commit or push your changes.

Use Codex to search the web for information and get up-to-date information for your task.

Codex Cloud tasks

Launch Codex Cloud task, pick environments, and apply the resulting diffs without leaving your terminal.

Scripting Codex

Automate repeatable workflows by scripting Codex with the exec command.

Model Context Protocol

Give Codex access to additional third-party tools and context with Model Context Protocol (MCP).

Approval modes

Choose the approval mode that matches your comfort level before Codex edits or runs commands.

Take Codex everywhere

Next steps