08Install guides · 10 min
Install Codex CLI
Codex CLI is OpenAI's coding agent for the terminal. It reads your project, runs commands and makes changes you approve.
Roman Urdu: Codex OpenAI ka terminal agent ha. ChatGPT account se login hota ha, free plan pe bhi kuch limit ke saath chal jata ha.
Cost: Included with ChatGPT plans, Free included: Free $0, Go $8/month, Plus $20/month, Pro from $100/month, Business $20/user/month billed yearly. Usage limits differ by plan. With an API key instead, you pay standard API rates (Codex pricing page, 2026-12-05).
Windows
- Codex runs natively on Windows with its own Windows sandbox. In PowerShell:
$ powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" - Or, if you have Node.js:
$ npm install -g @openai/codex - Prefer Linux tools? Use WSL 2 (WSL 1 is no longer supported) and follow the Linux tab inside Ubuntu.
- Open a new terminal in your project folder and start it. Pick Sign in with ChatGPT:
$ codex
macOS
- Run the official installer:
$ curl -fsSL https://chatgpt.com/codex/install.sh | sh - Or with Homebrew:
$ brew install --cask codex - Or with npm:
$ npm install -g @openai/codex - Start it in your project folder and pick Sign in with ChatGPT:
$ codex
Linux (Ubuntu/Debian)
- Run the official installer (Ubuntu, Debian, Fedora, WSL 2):
$ curl -fsSL https://chatgpt.com/codex/install.sh | sh - Or with npm:
$ npm install -g @openai/codex - Start it in your project folder and pick Sign in with ChatGPT:
$ codex - No browser on this machine (a server, or a remote login)? Turn on device code login in your ChatGPT security settings first, then:
$ codex login --device-auth
Check it worked
$ codex --versioncodex-cli 0.x.x (npm had 0.174.0 on 2026-12-05)
Common errors
codex: command not foundor not recognized- Open a new terminal window so it picks up the new PATH.
npm install -gfails with EACCES- Do not use sudo. Use the official installer above, or install Node with nvm/fnm (see the Node.js guide).
- Login page does not come back to the terminal (remote machine or WSL)
- Use
codex login --device-authafter turning on device code login in ChatGPT settings. - You hit a usage limit
- Each ChatGPT plan has its own limit. Wait for it to reset, upgrade, or sign in with an API key (
printenv OPENAI_API_KEY | codex login --with-api-key), billed at API rates. - Codex fails inside WSL 1
- WSL 1 support ended with Codex 0.115. Upgrade the distro:
wsl --set-version Ubuntu 2.
Official docs
- Codex docs: CLI
- Codex docs: Pricing
- Codex docs: Sign in
- Codex docs: Windows
- Codex docs: WSL
- github.com/openai/codex
Checked against these pages on 2026-12-05. Tools change: if a step differs, the official page wins.