- You install Codex CLI with one command: curl on macOS and Linux, PowerShell on Windows, or npm or Homebrew.
- Then you type codex in a project folder and sign in with a ChatGPT account or an API key.
- Do the first task in a Git repository, in read-only mode.
- Prices and limits change often, so check them on OpenAI's page.
You install Codex CLI with one command in the terminal. On macOS and Linux it is curl -fsSL https://chatgpt.com/codex/install.sh | sh, and in Windows PowerShell it is the irm command with the install.ps1 address. Then you type codex in a project folder and sign in with a ChatGPT account. Below are the full commands, the prices and a safe first task.
Codex CLI is a coding agent from OpenAI that runs locally on your computer. It reads project files, proposes changes and runs commands. If you know Claude Code, the idea is the same: you talk to an agent in the terminal. What differs is the provider and the account you use.
What you need before installing Codex CLI
OpenAI’s documentation asks for nothing besides the installer itself. It does tell you what to sign in with, though: a ChatGPT account or an API key. Settle two things first.
- Account. The pricing page lists Codex in the CLI for the Plus plan and above and for an API key. For Free and Go it names only the desktop app.
- Project folder. Ideally a Git repository with no unsaved changes, so you can undo any change the agent makes.
An ordinary terminal is enough. On macOS that is Terminal, on Windows PowerShell. If curl or npm says it does not know the command, finish setting up the system itself first, because that is not a Codex problem.
How to install Codex on macOS and Linux
Open the terminal and paste the command from the documentation:
curl -fsSL https://chatgpt.com/codex/install.sh | sh
The same command updates it later. Alternatives for people who prefer a package manager:
brew install --cask codex
npm install -g @openai/codex
The first is Homebrew, the second npm. With Homebrew you get a newer version with brew upgrade --cask codex. Today I checked the npm registry: the @openai/codex package exists, is at version 0.171.0 and is Apache-2.0 licensed. That was a registry lookup, not an installation: Codex is not installed on the computer where I am preparing this text, so I did not run the install. The steps below come from the documentation.
How to install Codex on Windows
On Windows, start from a new PowerShell window. The documentation gives this command:
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
The -ExecutionPolicy ByPass option lets this one script run despite PowerShell’s default restrictions. It applies only to this command. The installer downloads from releases.openai.com and falls back to GitHub Releases if that fails. You can also use npm, just as on macOS.
Codex runs natively on Windows. The Windows page describes three kinds of sandbox for commands: mxc, elevated and unelevated. The recommended mxc needs Windows 11 version 24H2 or 25H2 with an update Microsoft is still rolling out. On older systems Codex uses the legacy options, and elevated needs approval from an administrator. For your first run you do not have to change anything.
First run and signing in
Go to your project folder and start the agent:
cd /path/to/your/project
codex
On the first run choose Sign in with ChatGPT. A browser opens, and after you sign in the credentials return to Codex. The login is cached, so later sessions start straight away. codex login status shows the current method, and codex logout signs you out.
The second way is an API key. Billing then follows API pricing, not your ChatGPT plan, and the cloud features do not work. You pass the key through standard input:
printenv OPENAI_API_KEY | codex login --with-api-key
On a machine without a browser the documentation recommends device code sign-in: codex login --device-auth.
How much Codex costs: plans and prices
Codex has no separate subscription. It comes with ChatGPT plans, and usage counts against the plan’s allowance. The prices below come from OpenAI’s pricing page, opened today.
| Free | Go | Plus | Pro | |
|---|---|---|---|---|
| Price per month | $0 | $8 | $20 | from $100 |
| Codex in the CLI per the list | not listed | not listed | yes | yes (everything in Plus and more) |
| Note | desktop app, subject to rollout | desktop app, subject to rollout | web, CLI, IDE and iOS | plans at $100, $200 and $500 |
For teams, the Business plan costs $20 per user per month billed annually (minimum 2 users) and $25 billed monthly. The Plus plan has an estimate of 17–180 local messages per five hours for the GPT-6.2 Sol model, but that is not a fixed limit: actual use depends on the task. You see the current state in the usage dashboard. For a comparison with the competition, see my text on Claude Code pricing.
The first task: safe and read-only
Codex has a sandbox. By default the agent has no network access, and writing is limited to the current project folder. When it wants to go beyond those limits, it asks for approval. To start, you can narrow the permissions to read-only:
codex --sandbox read-only --ask-for-approval on-request
Or type /permissions during a session. The first prompt the documentation suggests is this:
Tell me about this project
This task changes nothing, so there is nothing to undo. The documentation advises making Git checkpoints before and after a task. If you want to change something, begin with a small thing, such as a typo in the documentation, and read the diff before you commit. I describe the working rules for an agent in more depth in my text on your first session with Claude Code.
- 01InstallOne command, or npm or Homebrew.
- 02Sign inA ChatGPT account or an API key.
- 03RepositoryClean Git state, a separate branch.
- 04ReadA first question with no file changes.
- 05ChangeA small step with approval.
- 06ReviewYou read the diff and commit.
Where the config file is
You keep user settings in the config file ~/.codex/config.toml. There you can set, for example, the default model: model = "gpt-6.1-sol". You add settings for one project in a .codex/config.toml file in the repository, but Codex loads them only when you trust the project. Command-line flags take precedence, then the project file, then the user file. I cover a similar idea, layers of settings, in my text on Claude Code configuration.
Do not change anything to start with. Once you notice you keep correcting the same thing, only then record it in the settings.
If you would like short, checked guides to agent tools, join my newsletter: now and then you will get changes in prices and install commands that I checked in the documentation.
Build with AI. Step by step.
I do not copy headlines. Once a week I write about what I test myself while building Frinter, the warehouse agent and sites in 1:1 workshops: what worked, what did not and why.
- Behind the scenes of my projects
- Decisions, mistakes and their cost
- One proven way of working
First-session checklist for Codex
- Codex installed in one of the four ways, and
codexstarts in the project folder. - Signed in with a ChatGPT account (
codex login statusshows the state) or an API key. - A Git repository with no unsaved changes and a separate branch.
- A first prompt that only reads, for example “Tell me about this project”.
- Permissions checked with
/permissions, no allow-everything. - The diff read before you commit.
Last checked: 22 November 2026. Prices, limits and model names change often, so check them in the sources below the text before you buy a plan.

