Codex Installation & Usage

System Requirements

You need a supported operating system, Git, a working shell, and an OpenAI account with access to Codex. For local projects, make sure your repository and dependency tools work outside Codex first.

Download and install the Codex Desktop App from the official OpenAI distribution channel for your platform. Sign in, then add a local Git project.

The Desktop App is the best starting point for this tutorial because it exposes Local/Cloud tasks, diff review, plugins, automations, and computer-use workflows in one place.

2. Install Codex CLI

The CLI is optional but highly useful for terminal workflows and scripting.

Method 1: Official Install Script

Use the official install path when available in the current documentation.

Method 2: npm

npm install -g @openai/codex
codex --version

Method 3: Homebrew (macOS)

Use the Homebrew formula or cask when it is available for your platform.

Verify And Update

codex --version
codex login

Update using the same package manager you used to install it.

3. Install The IDE Extension (Optional)

Install the Codex extension for your editor when you want editor-local context and inline workflows.

Login Methods

1. ChatGPT Account

Recommended for most individual developers. Sign in through the browser flow or app login flow.

2. OpenAI API Key / Access Token

Useful for API-based or automation-oriented setups. Keep credentials out of prompts, logs, and repositories.

Directories And Environment Variables

CODEX_HOME controls where Codex reads config, state, skills, and logs. Use it for isolated setups.

Troubleshooting

codex: command not found

Check your package-manager install location and ensure the binary directory is on PATH.

Unexpected Shell Behavior On Windows

Confirm which shell Codex is using and whether scripts assume Bash, PowerShell, or cmd behavior.

Login Failure Or 401

Sign out and sign in again, confirm account access, and check whether the current surface supports your plan.

Environment Health Check

Run the project's normal build or test command outside Codex first. Codex can only rely on tools that work in the environment.

Next Steps

Continue with Desktop App.

评论