Back to guides
Coding agents·September 17, 2026·6 min read

Install Codex CLI: setup, sign-in, and your first task

Choose one install method, verify the executable, sign in, and start with a small project task before adding custom-provider configuration.

Last reviewed on .

Install Codex CLI, verify the executable, sign in, and begin with a small task in your project directory. The official installers now cover macOS, Linux, and Windows; npm and Homebrew remain alternatives. Choose one route below. A working installation is the first step; account access and API billing are separate choices.

1. Choose one installation method

These commands come from the official Codex CLI installation guide. Use the installer for the environment where you will run the agent. Installing a Windows executable does not install a separate Linux copy inside WSL, and installing on your laptop does not install on a remote server you connect to later.

macOS or Linux: official standalone installer
curl -fsSL https://chatgpt.com/codex/install.sh | sh
Windows: official standalone installer
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

If you already manage development tools with a package manager, use its alternative instead of running both installers:

MethodInstallUpdate
npmnpm install -g @openai/codexnpm install -g @openai/codex
Homebrewbrew install --cask codexbrew upgrade --cask codex
StandaloneRun the installer for your OSRun that same installer again

The npm route requires a working npm installation; check npm --version first. The standalone route is useful if you do not otherwise need Node tooling. On a managed machine, use the installation method your administrator supports so later updates remain predictable.

2. Verify which executable runs

Start a fresh terminal after installation if the command is not found. On macOS or Linux, command -v codex shows the executable selected by your shell. In PowerShell, use Get-Command codex. Compare that path with the installation method you chose before reinstalling. Two installed copies can leave you updating one while continuing to launch another.

Verify, sign in, and run a first task
codex --version
codex --help

# Open your own project directory before starting
cd /path/to/your/project
codex login
codex login status
codex --sandbox read-only "Explain this project's structure and how its tests run. Do not modify files."

Replace the example project path with your own. The final command uses a read-only sandbox for an initial explanation. This is a useful first check because you can confirm the correct repository and model access before asking the agent to make a change. If you want to inspect available flags, use the installed CLI's help or the command reference.

3. Choose the right account path

codex login starts the account sign-in flow. Check the browser account and workspace before completing it. For direct OpenAI API billing, the documented alternative accepts a Platform key through standard input:

Optional: OpenAI Platform API authentication
# After supplying OPENAI_API_KEY through your credential setup:
printenv OPENAI_API_KEY | codex login --with-api-key

This API command is for an OpenAI Platform key. It is not the complete setup for a third-party gateway. A custom provider needs its own configuration, endpoint, credential source, and supported model. The authentication documentation explains the routes, while our Codex API-key guide covers the deeper provider setup.

4. Turn the first response into a useful first task

  1. Ask where the relevant source and tests live, then check the answer against the repository.
  2. Pick one small change and state its expected behavior.
  3. Use a clean branch or a checkpoint, and choose permissions appropriate to that change.
  4. Have Codex run the relevant checks, then review its diff and explanation.

For example, start with one failing test or a small documentation fix. Avoid making the first task an entire application rewrite: installation, credentials, local dependencies, and task quality would all be harder to assess at once. Once the short loop works, add your project instructions and expand the scope.

If setup stops, fix the matching layer

“Command not found” points to installation or PATH. A 401 points to authentication. A model error points to the selected provider and model. A limit warning points to usage or billing. Keep the working layers and follow the 401 checklist or usage-limit guide as appropriate; reinstalling the executable will not replenish an account.

To evaluate Kunavo for local Codex work, create an account and follow the Codex integration. It uses a Responses-compatible provider configuration. Verify one small task before relying on the new billing route for a larger project.

FAQ

How do I install Codex CLI?

Use the official standalone installer for your operating system, or the npm or Homebrew alternative. Open a new terminal if needed, check codex --version, then start Codex from your project directory and choose your authentication method.

Is npm install -g @openai/codex still supported?

Yes. The official installation documentation checked on September 17, 2026 lists npm alongside standalone installers and Homebrew. Pick one installation method and use its update path to avoid conflicting copies.

Do I need a ChatGPT subscription to install Codex?

Installation and model access are separate. Choose an available ChatGPT sign-in route or separately billed API access for supported local work. Check the current account options before choosing how to pay; installing the CLI does not add model credit.

Can I install Codex on Windows?

Yes. OpenAI provides a Windows standalone installer. If you choose to work inside WSL instead, install and run the Linux version inside that environment and keep track of its separate project paths and environment variables.

Official installation documentation and local CLI help checked September 17, 2026.