If you have already used Codex in ChatGPT, the Codex CLI will feel familiar. It brings the same AI assistance directly into your local development environment, where it can work with your repository, shell, tests, and other tools.
Installation takes only one command, but the setup choices that follow are worth reviewing carefully.ย In this article, youโll learn how to install Codex CLI on Windows, macOS, and Linux and complete a clean first-time setup.
Use the standalone installer if you do not already manage developer tools through Homebrew or npm.
PowerShell on a supported Windows system. WSL2 is optional.curl available.Open a terminal. Next, run the command for your operating system.
curl -fsSL https://chatgpt.com/codex/install.sh | sh
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
You can also run this via CMD. It executes the PowerShell command.

The Windows installer adds Codex to your PATH; consequently, it is ready for use. It also offers to launch the application.
Note: If the installer asks to start Codex immediately, press N. Do this unless the terminal is already inside a project folder.
Do you prefer a package manager? Use one of these options instead:
# Homebrew
brew install --cask codex
# npm
npm install -g @openai/codex
Similarly, Homebrew is suitable for a Brew-managed Mac setup. Use npm if Node.js already manages your global developer tools.
Move into the repository where you want Codex to work. Then, launch it.
# Windows PowerShell
cd C:\Users\you\code\my-project
codex
# macOS or Linux
cd ~/code/my-project
codex
Codex treats the current directory as its starting workspace. By default the System32 directory would be the default one.
The first launch offers three sign-in routes:

OpenAI’s current Codex pricing page lists Free, Go, Plus, Pro, Business, Edu, and Enterprise plans. API-key usage is billed separately. On the other hand, usage in a subscription is shared between the web app and Codex.
If you choose ChatGPT, Codex prints an authentication URL. It also opens this URL in your browser. If the browser does not open, copy and paste the URL yourself.

Next, sign in to the browser using the ChatGPT account you want Codex to use.

Check the account on the confirmation screen before you continue.

As a result, when the browser shows the success page, close the tab. Then, return to the terminal.

Back in the terminal, Codex confirms your account. It also reminds you that autonomy is a choice. Do not ignore this notice. Press Enter after you read it.

You can inspect or change the active boundary later. Use the /permissions command to do this.
Codex now prints the directory it is about to trust. Read the path carefully. Do not just look at the highlighted option.

Trust allows project-local configuration, hooks, and execution policies to load. If the path is wrong, quit the program. Move into the correct repository and run codex again.
On native Windows, Codex may ask how to create its sandbox. Choose the default sandbox if you can approve the administrator prompt.

OpenAI’s Windows sandbox documentation calls the elevated mode the preferred native setup. It uses lower-privilege sandbox users. It also uses filesystem boundaries, firewall rules, and local policy changes. The non-admin mode exists for machines where elevation is unavailable. However, it offers weaker protection.
Once the prompt appears, start with a read-only task. This confirms that Codex can see the repository. It does not ask the tool to modify anything.
Explain this repository's structure. Do not change any files. Then list the three commands I should run to verify it locally.

AGENTS.md file for repository-specific instructions.Keep the default workspace boundary unless the task needs more access. The permissions documentation explains the read-only, workspace, and full-access profiles.
For a standalone installation, rerun the platform installer. OpenAI uses the same command for installation and updates.
# macOS or Linux
curl -fsSL https://chatgpt.com/codex/install.sh | sh
# Windows PowerShell
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
Update package-manager installs through the same manager:
# Homebrew
brew upgrade --cask codex
# npm
npm install -g @openai/codex@latest
Finish with codex --version to confirm the installed build.
Installing Codex CLI comes down to three moves:
The only genuinely bad setup is the convenient one in the wrong directory. Launch from the repository, keep the sandbox boundary, check /permissions, and begin with a read-only instruction.
Once that is clean, run /init and let the project carry its own rules.
Read more: Top 10 Skills for Claude Code and Codex CLI
A. The CLI is free to install. Codex is included with ChatGPT Free, Go, Plus, Pro, Business, Edu, and Enterprise plans, with different limits. API-key usage is billed separately.
A. No. The standalone installer does not require Node.js. You need it only if you choose the npm installation method.
A. No. Codex runs natively on Windows with a Windows sandbox. WSL2 remains useful when your repository and toolchain already live in Linux.
A. Yes. Choose ‘Provide your own API key’ during setup. That usage follows OpenAI Platform billing, not your ChatGPT plan allowance.
A. Run codex login status to inspect it. Run codex logout to clear the cached credentials.