Installation & Login

System requirements

PlatformCodex CLICodex AppNotes
macOSIntel / Apple Silicon
WindowsNative PowerShell sandbox, or WSL2 for a Linux toolchain
LinuxCommon on servers and CI

Other requirements:

  • Network access to OpenAI services
  • Git (recommended for diff and checkpoints)
  • Terminal: Windows Terminal, iTerm2, Kitty, etc.

Install Codex CLI

macOS / Linux:

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

Windows (PowerShell):

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

Unattended install:

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

Method 2: npm

npm install -g @openai/codex

Method 3: Homebrew (macOS)

brew install --cask codex

Verify

codex --version

Login

The first codex run prompts for authentication. Two options:

  • Requires a plan that includes Codex (Plus / Pro, etc.)
  • Configures the API key automatically
  • Cloud features and quotas may differ from raw API billing—check official docs

2. OpenAI API key

  • Good for CI and pay-as-you-go enterprise use
  • Create a key at platform.openai.com
  • Some ChatGPT-only features may be unavailable

Directories and environment variables

Path / variableMeaning
~/.codex/Default Codex home (CODEX_HOME overrides)
~/.codex/config.tomlUser-level configuration
~/.codex/AGENTS.mdGlobal agent instructions
CODEX_HOMEAlternate config root (multi-profile, automation users)
CODEX_NON_INTERACTIVENon-interactive install script mode

IDE extension (optional)

After install, open the Codex panel in the sidebar and sign in with ChatGPT or an API key. Agent mode can read and write the project by default.


Codex App (optional)

Download macOS / Windows installers from Codex Quickstart, select a project folder, and send your first message in Local mode.


Troubleshooting

codex: command not found

  • Confirm the install script added the binary to PATH
  • For npm global installs, ensure npm prefix -g is on PATH

Unexpected Shell behavior on Windows

  • Prefer official Windows sandbox docs: Windows setup
  • Use WSL2 when you need a Linux-native toolchain

Login failure or 401

  • Check system time, proxy, and firewall
  • Verify the API key is valid and Codex is enabled for your org

Next steps