08 [Install guides](https://logicpacks.io/install) · 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](#windows) · [macOS](#macos) · [Linux (Ubuntu/Debian)](#linux)

## Windows

1.  Codex runs natively on Windows with its own Windows sandbox. In PowerShell:
    
    ```sh
    powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
    ```
    
2.  Or, if you have [Node.js](https://logicpacks.io/install/node):
    
    ```sh
    npm install -g @openai/codex
    ```
    
3.  Prefer Linux tools? Use WSL 2 (WSL 1 is no longer supported) and follow the Linux tab inside Ubuntu.
4.  Open a new terminal in your project folder and start it. Pick **Sign in with ChatGPT**:
    
    ```sh
    codex
    ```
    

## macOS

1.  Run the official installer:
    
    ```sh
    curl -fsSL https://chatgpt.com/codex/install.sh | sh
    ```
    
2.  Or with Homebrew:
    
    ```sh
    brew install --cask codex
    ```
    
3.  Or with npm:
    
    ```sh
    npm install -g @openai/codex
    ```
    
4.  Start it in your project folder and pick **Sign in with ChatGPT**:
    
    ```sh
    codex
    ```
    

## Linux (Ubuntu/Debian)

1.  Run the official installer (Ubuntu, Debian, Fedora, WSL 2):
    
    ```sh
    curl -fsSL https://chatgpt.com/codex/install.sh | sh
    ```
    
2.  Or with npm:
    
    ```sh
    npm install -g @openai/codex
    ```
    
3.  Start it in your project folder and pick **Sign in with ChatGPT**:
    
    ```sh
    codex
    ```
    
4.  No browser on this machine (a server, or a remote login)? Turn on device code login in your ChatGPT security settings first, then:
    
    ```sh
    codex login --device-auth
    ```
    

## Check it worked

```sh
codex --version
```

codex-cli 0.x.x (npm had 0.174.0 on 2026-12-05)

## Common errors

`codex: command not found` or not recognized

Open a new terminal window so it picks up the new PATH.

`npm install -g` fails with EACCES

Do not use sudo. Use the official installer above, or install Node with nvm/fnm (see the [Node.js guide](https://logicpacks.io/install/node)).

Login page does not come back to the terminal (remote machine or WSL)

Use `codex login --device-auth` after 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](https://developers.openai.com/codex/cli)
-   [Codex docs: Pricing](https://developers.openai.com/codex/pricing)
-   [Codex docs: Sign in](https://developers.openai.com/codex/auth)
-   [Codex docs: Windows](https://developers.openai.com/codex/windows)
-   [Codex docs: WSL](https://developers.openai.com/codex/windows/wsl)
-   [github.com/openai/codex](https://github.com/openai/codex)

Checked against these pages on 2026-12-05. Tools change: if a step differs, the official page wins.

[Install guides : All guides](https://logicpacks.io/install) [Next : Install Cursor (now Grok Build)](https://logicpacks.io/install/cursor)

---

Canonical URL: https://logicpacks.io/install/codex

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](https://logicpacks.io/llms.txt). Plain facts: [/about.md](https://logicpacks.io/about.md). Safety: [/safety.md](https://logicpacks.io/safety.md).
