How to Set Up Codex on Mac and Windows

Codex is OpenAI's coding agent. You give it a task in plain English, and it reads the files in a folder, edits them and runs commands on your computer. If you've only used ChatGPT in the browser, think of it as ChatGPT that does the work instead of describing it.

By the end of this guide you'll have Codex installed, signed in and working in a test folder on your own machine. It takes about 20 minutes.

What You Need

A ChatGPT account. Codex is included in the Free, Go, Plus, Pro, Business, Edu and Enterprise plans, so you can start without paying. Free and Go give you the desktop app with a lighter model. Plus is $20 a month and adds Codex on the web, in the CLI and in the IDE extension. Pro starts at $100 a month. Usage limits depend on your plan, and the pricing page has the current numbers.

You can also sign in with an OpenAI API key and pay per use. That works in the CLI, the SDK and the IDE extension, but it leaves out the cloud features. See the authentication page.

On a Mac, the CLI needs macOS 12 or newer. On Windows, Windows 11 is the recommended baseline. Windows 10 works on a best-effort basis and needs version 1809 or newer. Codex runs natively on Windows, and WSL2 also works if you prefer it.

The standalone installers below don't need Node.js. Only the npm route does.

Two Ways In

Codex comes as a desktop app and as a command-line tool. The desktop app is the ChatGPT app: when you start a chat, you pick "ChatGPT" or "Codex". Download it from chatgpt.com/download and sign in, and the app page walks you through it.

This guide covers the command-line tool, the less familiar of the two. Both sign in with the same ChatGPT account, so you can use either.

Open a Terminal on Mac

A terminal is a window where you type commands instead of clicking. Press Command + Space to open Spotlight, type "Terminal" and press Return. A window opens with a blinking cursor.

Open a Terminal on Windows

Press Windows + X and choose Windows PowerShell, or Terminal if that's what the menu shows. Open a fresh window for the install below.

Install on Mac

The standalone script is the first choice. Paste this into Terminal and press Return:

curl -fsSL https://chatgpt.com/codex/install.sh | sh

If you already use Homebrew, this works as well:

brew install --cask codex

A third route is npm, which needs Node.js already on your machine:

npm install -g @openai/codex

If the download fails, run this version instead. It fetches Codex from GitHub:

curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_INSTALLER_USE_RELEASES_OPENAI_COM=false sh

Install on Windows

In a new PowerShell window, run:

powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

The installer puts Codex in %LOCALAPPDATA%\Programs\OpenAI\Codex\bin and adds that folder to your PATH. If you have Node.js, the npm route also works:

npm install -g @openai/codex

If the download fails, this version fetches Codex from GitHub:

$env:CODEX_INSTALLER_USE_RELEASES_OPENAI_COM='false'; irm https://chatgpt.com/codex/install.ps1 | iex

Install Git too. Codex works without it, but the desktop app's review panel needs it:

winget install --id Git.Git

The Windows app page covers the desktop app and how to point Codex at WSL.

Check the Install

On either system, close the terminal, open a new one and run:

codex --version

A version number means it worked. The CLI page lists every install option.

First Run

Make a test folder and move into it. These two commands work in both Terminal and PowerShell:

mkdir codex-test
cd codex-test

Then start Codex:

codex

The first time, it asks you to sign in. Pick "Sign in with ChatGPT" and a browser tab opens. Log in, then come back to the terminal.

Now give it a real task. Try this:

Make a one-page HTML site about my dog. Ask me for the name and breed first.

Codex should ask its questions, write the files into your folder and tell you what it made. Open the HTML file in your browser to see the result. Once you've dropped a few files into the folder, try "rename the files in this folder to lowercase with dashes".

How Approvals Work

Codex runs inside a sandbox, which limits the files and network resources it can touch. Approvals decide when it stops and asks you. Start with "Ask for approval": Codex works inside your current folder and pauses before reaching beyond it. Read each request and answer yes or no.

There's also "Approve for me", which hands those requests to an automatic reviewer while keeping the same limits. A third mode, Full access, can cause accidental destructive changes. Keep it, and the --dangerously-bypass-approvals-and-sandbox flag, for a dedicated virtual machine. Leave Approve for me and Full access alone for now. The permissions page explains the modes.

Commands to Learn First

Type these inside a Codex session:

  • /init creates an AGENTS.md file, where you write standing instructions for a project.
  • /status shows the current session settings.
  • /permissions changes what Codex is allowed to do.
  • /model switches the model and its reasoning effort.
  • /review reviews your changes.

Type @ to attach a file by path. Ctrl+R searches your earlier prompts.

From the regular terminal prompt:

  • codex resume picks up a previous session.
  • codex login status shows whether you're signed in.
  • codex logout signs you out.
  • codex exec "your task" runs one task without opening the interactive screen.

The commands page has the full list.

Updating and Uninstalling

To update, run the same installer command again. Homebrew and npm have their own commands:

brew upgrade --cask codex
npm install -g @openai/codex

You can also try codex update. If your release doesn't support it, rerun the installer.

To remove the Windows desktop app, uninstall it through Windows Settings, and the cleanup runs on its own. If you want your Codex settings folder removed as well, set uninstall_codex_home = true in config.toml inside your %USERPROFILE%\.codex folder before you uninstall.

If Something Goes Wrong

If PowerShell says running scripts is disabled, usually on the npm route, run this and try again:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

If codex isn't recognized after installing, open a new terminal window first. If it still fails, the install folder isn't on your PATH.

If the wrong version of Codex starts on Windows, run Get-Command codex to see which copy PowerShell picks up. A standalone install and an npm install can compete with each other.

If Git features are missing on Windows, run winget install --id Git.Git.

If the browser sign-in fails, or you're on a remote machine, run codex login --device-auth. It's a beta feature, and you have to turn it on in your ChatGPT security settings first.

If you're behind a company proxy with a private certificate, set CODEX_CA_CERTIFICATE to the path of your company's root certificate file before running codex login.

If you see Windows sandbox error 1385, or a warning about folders writable by Everyone, follow the fixes on the sandbox page. The logs are in CODEX_HOME/.sandbox/sandbox.log.

If the terminal panel in the desktop app gets stuck, close and reopen it with Ctrl+`.

Where to Go Next

The Claude Code setup guide covers Anthropic's coding agent. The AI zero to hero guide goes through the wider picture. To compare notes with people who use these tools daily, join the Daily Driver AI community.

Checked against the docs on 30 October 2026.