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
- 1
Install the CLI
Grab the Codex CLI with npm. Use the tabs above if you prefer a different package manager.
npm install commandnpm i -g @openai/codexThe 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
Launch Codex
Open the interactive terminal UI and let Codex inspect your repo, edit files, and run commands alongside you.
codexThe 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
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 commandnpm 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.
Web search
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.






