2025-04-16 12:56:08 -04:00
<h1 align="center">OpenAI Codex CLI</h1>
2025-07-07 17:44:26 -07:00
<p align="center"><code>npm i -g @openai/codex </code><br />or <code>brew install codex</code></p>
2025-04-16 12:56:08 -04:00
2025-08-07 11:20:53 -07:00
<p align="center"><strong>Codex CLI</strong> is a coding agent from OpenAI that runs locally on your computer.</br>If you are looking for the <em>cloud-based agent</em> from OpenAI, <strong>Codex Web</strong>, see <a href="https://chatgpt.com/codex">chatgpt.com/codex</a>.</p>
2025-07-01 15:00:31 -07:00
2025-08-07 11:20:53 -07:00
<p align="center">
README / docs refactor (#2724)
This PR cleans up the monolithic README by breaking it into a set
navigable pages under docs/ (install, getting started, configuration,
authentication, sandboxing and approvals, platform details, FAQ, ZDR,
contributing, license). The top‑level README is now more concise and
intuitive, (with corrected screenshots).
It also consolidates overlapping content from codex-rs/README.md into
the top‑level docs and updates links accordingly. The codex-rs README
remains in place for now as a pointer and for continuity.
Finally, added an extensive config reference table at the bottom of
docs/config.md.
---------
Co-authored-by: easong-openai <easong@openai.com>
2025-08-27 10:30:39 -07:00
<img src="./.github/codex-cli-splash.png" alt="Codex CLI splash" width="80%" />
2025-08-07 11:20:53 -07:00
</p>
2025-04-16 12:56:08 -04:00
---
## Quickstart
2025-08-07 11:20:53 -07:00
### Installing and running Codex CLI
2025-07-07 17:44:26 -07:00
Install globally with your preferred package manager:
2025-04-16 12:56:08 -04:00
```shell
2025-07-07 17:44:26 -07:00
npm install -g @openai/codex # Alternatively: `brew install codex`
2025-04-16 12:56:08 -04:00
```
2025-08-07 11:20:53 -07:00
Then simply run `codex` to get started:
```shell
codex
```
2025-07-01 15:00:31 -07:00
2025-08-07 11:20:53 -07:00
<details>
<summary>You can also go to the <a href="https://github.com/openai/codex/releases/latest">latest GitHub Release</a> and download the appropriate binary for your platform.</summary>
2025-07-01 15:00:31 -07:00
2025-08-07 11:20:53 -07:00
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.
</details>
### Using Codex with your ChatGPT plan
<p align="center">
README / docs refactor (#2724)
This PR cleans up the monolithic README by breaking it into a set
navigable pages under docs/ (install, getting started, configuration,
authentication, sandboxing and approvals, platform details, FAQ, ZDR,
contributing, license). The top‑level README is now more concise and
intuitive, (with corrected screenshots).
It also consolidates overlapping content from codex-rs/README.md into
the top‑level docs and updates links accordingly. The codex-rs README
remains in place for now as a pointer and for continuity.
Finally, added an extensive config reference table at the bottom of
docs/config.md.
---------
Co-authored-by: easong-openai <easong@openai.com>
2025-08-27 10:30:39 -07:00
<img src="./.github/codex-cli-login.png" alt="Codex CLI login" width="80%" />
2025-08-07 11:20:53 -07:00
</p>
README / docs refactor (#2724)
This PR cleans up the monolithic README by breaking it into a set
navigable pages under docs/ (install, getting started, configuration,
authentication, sandboxing and approvals, platform details, FAQ, ZDR,
contributing, license). The top‑level README is now more concise and
intuitive, (with corrected screenshots).
It also consolidates overlapping content from codex-rs/README.md into
the top‑level docs and updates links accordingly. The codex-rs README
remains in place for now as a pointer and for continuity.
Finally, added an extensive config reference table at the bottom of
docs/config.md.
---------
Co-authored-by: easong-openai <easong@openai.com>
2025-08-27 10:30:39 -07:00
Run `codex` and select **Sign in with ChatGPT ** . We recommend signing into your ChatGPT account to use Codex as part of your Plus, Pro, Team, Edu, or Enterprise plan. [Learn more about what's included in your ChatGPT plan ](https://help.openai.com/en/articles/11369540-codex-in-chatgpt ).
2025-08-10 14:19:27 -07:00
README / docs refactor (#2724)
This PR cleans up the monolithic README by breaking it into a set
navigable pages under docs/ (install, getting started, configuration,
authentication, sandboxing and approvals, platform details, FAQ, ZDR,
contributing, license). The top‑level README is now more concise and
intuitive, (with corrected screenshots).
It also consolidates overlapping content from codex-rs/README.md into
the top‑level docs and updates links accordingly. The codex-rs README
remains in place for now as a pointer and for continuity.
Finally, added an extensive config reference table at the bottom of
docs/config.md.
---------
Co-authored-by: easong-openai <easong@openai.com>
2025-08-27 10:30:39 -07:00
You can also use Codex with an API key, but this requires [additional setup ](./docs/authentication.md#usage-based-billing-alternative-use-an-openai-api-key ). If you previously used an API key for usage-based billing, see the [migration steps ](./docs/authentication.md#migrating-from-usage-based-billing-api-key ). If you're having trouble with login, please comment on [this issue ](https://github.com/openai/codex/issues/1243 ).
2025-08-10 14:19:27 -07:00
README / docs refactor (#2724)
This PR cleans up the monolithic README by breaking it into a set
navigable pages under docs/ (install, getting started, configuration,
authentication, sandboxing and approvals, platform details, FAQ, ZDR,
contributing, license). The top‑level README is now more concise and
intuitive, (with corrected screenshots).
It also consolidates overlapping content from codex-rs/README.md into
the top‑level docs and updates links accordingly. The codex-rs README
remains in place for now as a pointer and for continuity.
Finally, added an extensive config reference table at the bottom of
docs/config.md.
---------
Co-authored-by: easong-openai <easong@openai.com>
2025-08-27 10:30:39 -07:00
### Model Context Protocol (MCP)
2025-08-08 18:30:34 -07:00
README / docs refactor (#2724)
This PR cleans up the monolithic README by breaking it into a set
navigable pages under docs/ (install, getting started, configuration,
authentication, sandboxing and approvals, platform details, FAQ, ZDR,
contributing, license). The top‑level README is now more concise and
intuitive, (with corrected screenshots).
It also consolidates overlapping content from codex-rs/README.md into
the top‑level docs and updates links accordingly. The codex-rs README
remains in place for now as a pointer and for continuity.
Finally, added an extensive config reference table at the bottom of
docs/config.md.
---------
Co-authored-by: easong-openai <easong@openai.com>
2025-08-27 10:30:39 -07:00
Codex CLI supports [MCP servers ](./docs/advanced.md#model-context-protocol-mcp ). Enable by adding an `mcp_servers` section to your `~/.codex/config.toml` .
2025-04-16 11:24:35 -07:00
2025-08-08 15:19:20 -07:00
README / docs refactor (#2724)
This PR cleans up the monolithic README by breaking it into a set
navigable pages under docs/ (install, getting started, configuration,
authentication, sandboxing and approvals, platform details, FAQ, ZDR,
contributing, license). The top‑level README is now more concise and
intuitive, (with corrected screenshots).
It also consolidates overlapping content from codex-rs/README.md into
the top‑level docs and updates links accordingly. The codex-rs README
remains in place for now as a pointer and for continuity.
Finally, added an extensive config reference table at the bottom of
docs/config.md.
---------
Co-authored-by: easong-openai <easong@openai.com>
2025-08-27 10:30:39 -07:00
### Configuration
2025-08-07 11:20:53 -07:00
README / docs refactor (#2724)
This PR cleans up the monolithic README by breaking it into a set
navigable pages under docs/ (install, getting started, configuration,
authentication, sandboxing and approvals, platform details, FAQ, ZDR,
contributing, license). The top‑level README is now more concise and
intuitive, (with corrected screenshots).
It also consolidates overlapping content from codex-rs/README.md into
the top‑level docs and updates links accordingly. The codex-rs README
remains in place for now as a pointer and for continuity.
Finally, added an extensive config reference table at the bottom of
docs/config.md.
---------
Co-authored-by: easong-openai <easong@openai.com>
2025-08-27 10:30:39 -07:00
Codex CLI supports a rich set of configuration options, with preferences stored in `~/.codex/config.toml` . For full configuration options, see [Configuration ](./docs/config.md ).
2025-08-05 11:31:11 -07:00
---
README / docs refactor (#2724)
This PR cleans up the monolithic README by breaking it into a set
navigable pages under docs/ (install, getting started, configuration,
authentication, sandboxing and approvals, platform details, FAQ, ZDR,
contributing, license). The top‑level README is now more concise and
intuitive, (with corrected screenshots).
It also consolidates overlapping content from codex-rs/README.md into
the top‑level docs and updates links accordingly. The codex-rs README
remains in place for now as a pointer and for continuity.
Finally, added an extensive config reference table at the bottom of
docs/config.md.
---------
Co-authored-by: easong-openai <easong@openai.com>
2025-08-27 10:30:39 -07:00
### Docs & FAQ
2025-08-21 11:26:37 -07:00
README / docs refactor (#2724)
This PR cleans up the monolithic README by breaking it into a set
navigable pages under docs/ (install, getting started, configuration,
authentication, sandboxing and approvals, platform details, FAQ, ZDR,
contributing, license). The top‑level README is now more concise and
intuitive, (with corrected screenshots).
It also consolidates overlapping content from codex-rs/README.md into
the top‑level docs and updates links accordingly. The codex-rs README
remains in place for now as a pointer and for continuity.
Finally, added an extensive config reference table at the bottom of
docs/config.md.
---------
Co-authored-by: easong-openai <easong@openai.com>
2025-08-27 10:30:39 -07:00
- [**Getting started** ](./docs/getting-started.md )
- [CLI usage ](./docs/getting-started.md#cli-usage )
- [Running with a prompt as input ](./docs/getting-started.md#running-with-a-prompt-as-input )
- [Example prompts ](./docs/getting-started.md#example-prompts )
- [Memory with AGENTS.md ](./docs/getting-started.md#memory--project-docs )
- [Configuration ](./docs/config.md )
- [**Sandbox & approvals** ](./docs/sandbox.md )
- [**Authentication** ](./docs/authentication.md )
- [Auth methods ](./docs/authentication.md#forcing-a-specific-auth-method-advanced )
- [Login on a "Headless" machine ](./docs/authentication.md#connecting-on-a-headless-machine )
- [**Advanced** ](./docs/advanced.md )
- [Non-interactive / CI mode ](./docs/advanced.md#non-interactive--ci-mode )
- [Tracing / verbose logging ](./docs/advanced.md#tracing--verbose-logging )
- [Model Context Protocol (MCP) ](./docs/advanced.md#model-context-protocol-mcp )
- [**Zero data retention (ZDR)** ](./docs/zdr.md )
- [**Contributing** ](./docs/contributing.md )
- [**Install & build** ](./docs/install.md )
- [System Requirements ](./docs/install.md#system-requirements )
- [DotSlash ](./docs/install.md#dotslash )
- [Build from source ](./docs/install.md#build-from-source )
- [**FAQ** ](./docs/faq.md )
- [**Open source fund** ](./docs/open-source-fund.md )
2025-04-16 12:56:08 -04:00
---
## License
Enforce ASCII in README.md (#513)
This all started because I was going to write a script to autogenerate
the Table of Contents in the root `README.md`, but I noticed that the
`href` for the "Why Codex?" heading was `#whycodex` instead of
`#why-codex`. This piqued my curiosity and it turned out that the space
in "Why Codex?" was not an ASCII space but **U+00A0**, a non-breaking
space, and so GitHub ignored it when generating the `href` for the
heading.
This also meant that when I did a text search for `why codex` in the
`README.md` in VS Code, the "Why Codex" heading did not match because of
the presence of **U+00A0**.
In short, these types of Unicode characters seem like a hazard, so I
decided to introduce this script to flag them, and if desired, to
replace them with "good enough" ASCII equivalents. For now, this only
applies to the root `README.md` file, but I think we should ultimately
apply this across our source code, as well, as we seem to have quite a
lot of non-ASCII Unicode and it's probably going to cause `rg` to miss
things.
Contributions of this PR:
* `./scripts/asciicheck.py`, which takes a list of filepaths and returns
non-zero if any of them contain non-ASCII characters. (Currently, there
is one exception for ✨ aka **U+2728**, though I would like to default to
an empty allowlist and then require all exceptions to be specified as
flags.)
* A `--fix` option that will attempt to rewrite files with violations
using a equivalents from a hardcoded substitution list.
* An update to `ci.yml` to verify `./scripts/asciicheck.py README.md`
succeeds.
* A cleanup of `README.md` using the `--fix` option as well as some
editorial decisions on my part.
* I tried to update the `href`s in the Table of Contents to reflect the
changes in the heading titles. (TIL that if a heading has a character
like `&` surrounded by spaces, it becomes `--` in the generated `href`.)
2025-04-22 07:07:40 -07:00
This repository is licensed under the [Apache-2.0 License ](LICENSE ).
README / docs refactor (#2724)
This PR cleans up the monolithic README by breaking it into a set
navigable pages under docs/ (install, getting started, configuration,
authentication, sandboxing and approvals, platform details, FAQ, ZDR,
contributing, license). The top‑level README is now more concise and
intuitive, (with corrected screenshots).
It also consolidates overlapping content from codex-rs/README.md into
the top‑level docs and updates links accordingly. The codex-rs README
remains in place for now as a pointer and for continuity.
Finally, added an extensive config reference table at the bottom of
docs/config.md.
---------
Co-authored-by: easong-openai <easong@openai.com>
2025-08-27 10:30:39 -07:00