← Back to all projects

Codex CLI

OpenAI's own terminal coding agent, written in Rust and fenced in by the operating system

OfficialApache-2.0
Stars
120k
Forks
18.2k
Open issues
14.3k
Last commit
28 Aug 2026

What is Codex CLI?

It works the way the other terminal agents do — read the repository, propose changes, run commands — but the boundary it enforces is unusual: on macOS and Linux it uses operating-system sandboxing to restrict which files and commands the agent can reach, so the limit does not depend on the model choosing to respect it. Sign-in runs through a ChatGPT plan or an OpenAI API key, which is the trade: the code is Apache-2.0, the model behind it is not the open part.

What can you do with Codex CLI?

  • Work in the checkout you already have — It runs against the local repository from the terminal: inspecting code, editing files and running commands in place, with no upload step and no separate workspace to keep in sync.
  • Decide the boundary before you need it — The permissions command sets what may be edited or executed without asking, and on macOS and Linux that choice is backed by operating-system sandboxing rather than by the agent's own restraint.
  • Write the project's standing rules down once — An init command creates an AGENTS.md holding the instructions that should apply to every session — build commands, conventions, things not to touch — instead of repeating them in each prompt.
  • Attach tools you already run — The mcp subcommand connects local or remote MCP servers, so internal services the agent should reach are configured once rather than wrapped in bespoke glue.
  • Move the same task between surfaces — A cloud command hands work off to run remotely, an IDE extension covers VS Code, Cursor and Windsurf, and a desktop app is available — the CLI is one entry point among several into the same product.

Before you choose Codex CLI

  • Authentication goes through a ChatGPT plan or an OpenAI API key, so unlike the multi-provider terminal agents in this category, the model behind it is not something you swap out freely.
  • The operating-system sandbox is described for macOS and Linux; on Windows the same guarantee is not stated, so the approval settings carry more of the weight there.

Star history

21 Aug to 28 Aug · +8.4k

111k120k

Frequently asked questions

Is Codex CLI free for commercial use?

Codex CLI is released under the Apache-2.0 licence — OSI-approved open source, which permits commercial use.

How can Codex CLI be deployed?

Codex CLI is available as Runs locally.

Documentation

Reproduced from the openai/codex README, published under Apache-2.0. Read the original ↗


Quickstart

Installing and running Codex CLI

Run the following on Mac or Linux to install Codex CLI:

curl -fsSL https://chatgpt.com/codex/install.sh | sh

Run the following on Windows to install Codex CLI:

powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

The standalone installers download from https://releases.openai.com/codex by default and fall back to GitHub Releases if a metadata or asset download is unavailable. To force GitHub Releases, set CODEX_INSTALLER_USE_RELEASES_OPENAI_COM to false (0 and no are also accepted):

curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_INSTALLER_USE_RELEASES_OPENAI_COM=false sh
$env:CODEX_INSTALLER_USE_RELEASES_OPENAI_COM='false'; irm https://chatgpt.com/codex/install.ps1 | iex

Codex CLI can also be installed via the following package managers:

# Install using npm
npm install -g @openai/codex
# Install using Homebrew
brew install --cask codex

Then simply run codex to get started.

Each GitHub Release contains many executables, but in practice, you likely want one of these:

  • macOS
    • Apple Silicon/arm64: codex-aarch64-apple-darwin.tar.gz
    • x86_64 (older Mac hardware): codex-x86_64-apple-darwin.tar.gz
  • Linux
    • x86_64: codex-x86_64-unknown-linux-musl.tar.gz
    • arm64: codex-aarch64-unknown-linux-musl.tar.gz

Each archive contains a single entry with the platform baked into the name (e.g., codex-x86_64-unknown-linux-musl), so you likely want to rename it to codex after extracting it.

Using Codex with your ChatGPT plan

Run codex and select Sign in with ChatGPT. We recommend signing into your ChatGPT account to use Codex as part of your Plus, Pro, Business, Edu, or Enterprise plan. Learn more about what’s included in your ChatGPT plan.

You can also use Codex with an API key, but this requires additional setup.

Docs

This repository is licensed under the Apache-2.0 License.