To install Codex CLI, run one command for your system. On macOS or Linux, run curl -fsSL https://chatgpt.com/codex/install.sh | sh. On Windows, use the PowerShell line below. Then run codex in a project folder and choose Sign in with ChatGPT. Codex CLI is OpenAI’s coding agent that runs in your terminal, on your own machine.
What is Codex CLI?
Codex CLI is a coding agent from OpenAI that runs locally. It reads the files in your project folder, edits them, and runs the tools already on your machine. It is separate from the Codex web agent at chatgpt.com/codex and from the Codex desktop app. The official README lists the IDE extension, the desktop app (codex app) and the cloud agent as other ways to use Codex.
Install commands
Use the command that matches your system. All of them come from the Codex CLI README on GitHub, read 2026-11-12.
| Route | Command | Platforms |
|---|---|---|
| Standalone installer | curl -fsSL https://chatgpt.com/codex/install.sh | sh | macOS, Linux |
| Standalone installer | powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" | Windows |
| npm | npm install -g @openai/codex | Any system with npm |
| Homebrew | brew install --cask codex | macOS |
| Manual binary | Download from the latest GitHub Release | macOS (arm64, x86_64), Linux (x86_64, arm64) |
The standalone installers download from releases.openai.com/codex by default. If that download fails, they fall back to GitHub Releases. To use GitHub Releases from the start, set CODEX_INSTALLER_USE_RELEASES_OPENAI_COM=false before you run the script. The README shows the exact line for each shell.
For the manual route, each archive holds one file with the platform in its name, such as codex-x86_64-unknown-linux-musl. Rename it to codex after you extract it.
Steps after install
- Open a project folder. Run
cdinto a repository, then runcodex. Codex reads the folder it starts in. - Sign in. On first run, pick Sign in with ChatGPT. The docs say that Codex is included in the Plus, Pro, Business, Edu and Enterprise plans. An API key also works, but it needs additional setup.
- Give it a first task. Ask it to explain the project, make one small change, or find a bug. Create a Git commit before a big task so you can go back.
- Learn the commands.
codex execruns one task without the chat screen. It is the option for scripts and CI. The Codex docs at developers.openai.com/codex list the rest.
Codex CLI reads its settings from ~/.codex/config.toml. The Codex CLI config reference lists the keys, with their defaults.
Update and uninstall
- Update. Run the same install command again. The docs list the standalone installer as the update route on macOS and Linux.
- Uninstall. For npm, run
npm uninstall -g @openai/codex. For Homebrew, runbrew uninstall --cask codex. The README gives no uninstall command for the standalone installer or the manual binary. For those, find the file withwhich codexand delete it.
Check the install
Run codex --version in a terminal. It prints the installed version. If the command is not found, open a new terminal window and try again, since the install may not be on your PATH yet. If it still fails, run the install again with the same route.
Memory: built in and add-ons
Codex has two built-in memory layers. AGENTS.md files hold rules you write, and Codex loads them at the start of every run. Codex memories are off by default. When you turn them on, Codex turns useful context from past chats into local files under ~/.codex/memories/. The full rules, limits and config keys are in Codex memory: AGENTS.md, memories and add-ons.
Built-in memory stays on one machine. For searchable memory that several agents share, add a hook-based plugin.
Hindsight is open-source memory for AI agents, with a server you can run yourself. Its Coding Agents package covers 22 command-line agents, Codex CLI and Claude Code among them, from one install command. Per the Hindsight coding agents docs, read 2026-11-12:
npx @vectorize-io/hindsight-coding-agents install codexwrites three hooks to~/.codex/hooks.jsonand an[mcp_servers]entry toconfig.toml. The Codex hooks needcodex_hooks = truein that file.- Memory goes into one bank per repository,
coding-agent::{gitProject}. Claude Code and Codex working on the same repo share that bank. - The memory can live in Hindsight Cloud, on a server you run, or in a local daemon.
Limits to know: the Codex hooks only work when codex_hooks = true is set, and the memory needs a Hindsight server (cloud, your own, or a local daemon) to be running. For a single small project, built-in AGENTS.md may be enough. The per-agent Claude Code plugin is retired. The same package covers Claude Code now, as described in Claude Code memory.
Hindsight is open source at github.com/vectorize-io/hindsight.
Related
- How to install Claude Code: the same steps for the other terminal coding agent.
- How to install Gemini CLI: Google’s terminal agent, with its GEMINI.md memory files.
- Codex memory: AGENTS.md, memories and how to add Hindsight.
- Codex CLI config reference: the keys in
config.toml. - Codex skills: where skill folders live, how to install one, and how to turn one off.
- Codex MCP: how to add, check and remove MCP servers, and which ones give Codex memory.