Skip to content
Cognova AI

AI Tools & ReviewsHow-to guide

How to Install Codex CLI on Windows, Mac and Linux (2026)

By , AI consultantsPublished

In short

On macOS or Linux, install Codex CLI with curl -fsSL https://chatgpt.com/codex/install.sh | sh. On Windows, run OpenAI's PowerShell installer or use WSL2. On any system with Node.js, npm install -g @openai/codex also works. Then open your project folder, run codex and choose Sign in with ChatGPT. OpenAI says Codex is included in every ChatGPT plan from Free to Enterprise. The latest stable release on November 20, 2026 was 0.171.0.

Codex CLI is OpenAI's coding agent for the terminal. It reads your code, runs commands and edits files in the folder you start it in. Searches for "install codex" and "codex cli" run to tens of thousands a month in the US, according to Semrush, and the install steps have changed several times this year.

This guide uses only OpenAI's own documentation and GitHub releases, checked on November 20, 2026. It is written for business owners deciding whether to let staff use Codex, and for the developer or IT person who will install it. We note which steps we ran ourselves on a Windows 11 PC and which come straight from OpenAI's docs.

What you need

  • A ChatGPT account (OpenAI lists Codex in the Free, Go, Plus, Pro, Business, Edu and Enterprise plans) or an OpenAI API key
  • macOS, Linux, or Windows with PowerShell (WSL2 is optional on Windows)
  • Node.js, only if you choose the npm install
  • A project folder to work in, ideally tracked in Git so you can undo changes

Time needed

10–20 minutes

  1. Step 1: Pick an install method

    OpenAI publishes four ways to install Codex CLI: a standalone installer script for macOS and Linux, a PowerShell installer for Windows, an npm package (@openai/codex) and a Homebrew cask. The installer scripts download a ready-built program, so they are the simplest choice if nobody on your team uses Node.js. Pick npm if your developers already manage tools that way.

  2. Step 2: Install on macOS or Linux

    Open Terminal and run curl -fsSL https://chatgpt.com/codex/install.sh | sh. On a Mac with Homebrew you can run brew install --cask codex instead. The installer downloads from releases.openai.com by default and can fall back to GitHub Releases. We did not run these two commands ourselves; they are copied from OpenAI's README and CLI docs.

  3. Step 3: Install on Windows

    Open PowerShell and run powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex". Codex runs natively in PowerShell. If you prefer Linux tools, install WSL2 with wsl --install from an elevated PowerShell, then run the macOS/Linux command inside WSL. OpenAI's docs say WSL1 stopped being supported after Codex 0.114, and recommend keeping repositories in the Linux home folder rather than under /mnt/c.

  4. Step 4: Or install with npm

    If Node.js is installed, run npm install -g @openai/codex. On November 20, 2026 we confirmed on a Windows 11 PC that the npm registry's current version is 0.171.0 (npm view @openai/codex version) and that npx -y @openai/codex@0.171.0 --version prints codex-cli 0.171.0. That matches the release marked Latest on OpenAI's GitHub releases page.

  5. Step 5: Check the install

    Close and reopen your terminal, then run codex --version. If the command is not found, the install folder is not on your PATH yet; reopening the terminal usually fixes it. Codex 0.171.0 also has a built-in check, codex doctor, which diagnoses the local installation, configuration, sign-in and runtime health.

  6. Step 6: Sign in

    Move into your project folder and run codex, then choose Sign in with ChatGPT, which OpenAI recommends. You can also run codex login to open the browser sign-in, codex login --device-auth (marked beta) on a machine without a browser, or pipe an API key into codex login --with-api-key. Check which account is active with codex login status, and sign out with codex logout.

  7. Step 7: Set permissions and project instructions

    Inside a Codex session, type /permissions to choose what Codex may do without asking, and /status to see the current session settings. Type /init to create an AGENTS.md file, where you write instructions Codex should follow in that project, such as how to run tests. OpenAI warns that full access mode can cause unintended destructive actions, so start with the default permissions.

  8. Step 8: Keep it up to date

    OpenAI's docs say to update by running the installer command again. Version 0.171.0 also includes a codex update command, which its help text describes as updating Codex to the latest version. If you installed with npm, update with npm; if you used Homebrew, update with Homebrew. Releases are frequent, so check the GitHub releases page before you standardise a version across a team.

Which ChatGPT plan you need

OpenAI’s pricing page, checked on November 20, 2026, says Codex is included in ChatGPT Free, Go, Plus, Pro, Business, Edu and Enterprise. Published prices were $0 for Free, $8 a month for Go and $20 a month for Plus. Pro is offered at $100, $200 or $500 a month. Business was listed at $20 per user per month billed annually or $25 billed monthly, and Enterprise and Edu are priced through sales. Higher plans give more usage before you hit limits.

For a business, the practical choice is usually between individual Plus accounts and a Business workspace. A workspace gives you central billing and admin control over who uses Codex.

Troubleshooting

  • codex is not recognized after install. Close every terminal window and open a new one. Run codex --version again.
  • Sign-in on a remote server. Use codex login --device-auth. OpenAI also documents forwarding port 1455 over SSH, or copying ~/.codex/auth.json from a machine where you signed in.
  • WSL is slow on large repositories. OpenAI suggests running wsl --update and then wsl --shutdown, and keeping code inside the Linux file system.
  • Something else is wrong. Run codex doctor and read its report before reinstalling.

What we verified

On a Windows 11 PC on November 20, 2026, we ran npm view @openai/codex version (0.171.0), npx -y @openai/codex@0.171.0 --version (codex-cli 0.171.0), and the help for codex and codex login. This confirmed the login, logout, update, doctor and app commands and the --device-auth and --with-api-key options. We did not sign in or run the installer scripts. Those steps are taken from OpenAI’s documentation as linked in the sources.

How Cognova AI can help

We help small teams decide which AI coding and automation tools to adopt, set up safe permissions and project instructions, and train staff to use them. See AI Consulting, or compare with our Claude Code install guide.

Frequently asked questions

Is Codex CLI free to use?

The CLI itself costs nothing to install. Usage comes from your ChatGPT plan or your API account. OpenAI's pricing page says Codex is included in ChatGPT Free, Go, Plus, Pro, Business, Edu and Enterprise, and lists Free at $0 and Go at $8 a month. Higher plans allow more use. If you sign in with an API key instead, you pay OpenAI's API rates.

Does Codex CLI work on Windows without WSL?

Yes. OpenAI publishes a PowerShell installer, and Codex runs natively in PowerShell with its own Windows sandbox. WSL2 is still an option if your developers prefer Linux tools. WSL1 is no longer supported after version 0.114. We confirmed that Codex 0.171.0 runs and reports its version on Windows 11 through npm.

What is the difference between Codex CLI, the Codex app and the IDE extension?

All three use the same Codex agent. The CLI runs in a terminal. The desktop app, which you can open by running codex app or from OpenAI's Codex page, gives a windowed interface and is available on Windows. The IDE extension adds Codex to VS Code, Cursor and Windsurf. Most teams start with whichever matches where their developers already work.

Sources

  1. 1OpenAI Codex README (GitHub)
  2. 2OpenAI: Codex CLI documentation
  3. 3OpenAI: Codex authentication
  4. 4OpenAI: Codex on WSL
  5. 5OpenAI: Windows sandbox
  6. 6OpenAI: Codex pricing
  7. 7OpenAI Codex release 0.171.0 (GitHub)
  8. 8npm: @openai/codex
  9. 9Semrush Keyword Overview: install codex (US database, November 2026)

Cite this article

Cognova AI. (2026, November 20). How to Install Codex CLI on Windows, Mac and Linux (2026). Cognova AI. https://cognovaai.com/insights/how-to-install-codex-cli

Permanent link: cognovaai.com/insights/how-to-install-codex-cli. Quoting a passage? Select it and use “Copy quote” to get a link that jumps to that exact text.

Up nextHow to Install Claude Code on Windows, Mac and Linux (2026)On macOS, Linux or WSL, run curl -fsSL https://claude.ai/install.sh | bash. On Windows PowerShell, run irm https://claude.ai/install.ps1 | iex, or use winget install Anthropic.ClaudeCode. Then run claude in your project folder and sign in. Claude Code needs a paid Claude plan (Pro starts at $20 a month billed monthly) or a Claude Console account; the free plan does not include it. Check the install with claude --version and claude doctor.Continue reading

See where AI fits in your business

A 30-minute call with a consultant, not a sales rep. You leave with at least one concrete next step, whether or not we work together.