A coding agent that lives in your terminal removes the context-switch between editor and browser, and the OpenAI Codex CLI is the fastest way to get one running on your own machine. It reads your project, suggests and applies edits, runs commands, and authenticates against either a ChatGPT plan or an API key. Setup takes a few minutes once Node is in place.

Quick Answer

Install Node.js 22 or newer, run npm install -g @openai/codex, then run codex and sign in with your ChatGPT account or an API key. On the first launch Codex prompts you to authenticate, and once that is done you can point it at any local project and start issuing coding tasks.

Getting the Prerequisites in Place

Codex is a Node package, so a current Node runtime is the one real dependency. Install Node.js 22 or later and confirm it with node --version before going further. A capable workstation makes a real difference here, since the agent runs builds, tests and tooling locally while it works. If you are setting up a fresh developer machine, the AI-ready PC range at Evetech covers well-specced multi-core, high-RAM systems suited to these workloads.

Installing the CLI

You have a few clean install paths, so pick the one that suits your platform:

  1. The cross-platform route is npm: run npm install -g @openai/codex to install it globally. This is the most predictable option on Windows, macOS and Linux alike.
  2. On macOS or Linux you can instead run the official install script with curl -fsSL https://chatgpt.com/codex/install.sh | sh.
  3. On Windows the equivalent script runs through PowerShell with irm https://chatgpt.com/codex/install.ps1 | iex.
  4. Homebrew users on macOS can run brew install --cask codex if they prefer to manage it that way.

After it installs, type codex in any terminal. If you hit a "command not found" error, your global npm bin directory is not on your PATH, which is the most common first-run snag and a quick fix.

Authenticating Your Account

On first run Codex opens an interactive sign-in. The recommended path is "Sign in with ChatGPT", which ties Codex usage to your existing ChatGPT plan with no separate key to manage. If you would rather use the API, set the environment variable OPENAI_API_KEY to your key and Codex will pick it up. For headless setups such as a server or CI runner, the device-code flow with codex login --device-auth gives you a link to open in any browser and a one-time code to paste back.

Treat the stored credentials like a password. The auth file in your home directory under the Codex config folder should never be committed to a repository, pasted into a support ticket, or shared in chat.

Approval Modes and the Sandbox

Codex gives you three levels of autonomy over what it can do without asking first. In the default suggest mode, it proposes every file change and command and waits for your approval before touching anything. Auto-edit mode lets it apply file changes directly but still asks before running shell commands. Full auto removes the confirmation step entirely and the agent works uninterrupted.

Start on suggest mode while you are learning how Codex behaves on your codebase. Move to auto-edit once you trust its file-change quality. Reserve full auto for well-understood, low-risk tasks inside a version-controlled project where rolling back is easy. The sandbox option runs commands in an isolated environment rather than directly on your filesystem, which is worth enabling for any agent task that touches build scripts or package management.

Running Your First Task

With Codex authenticated, change into a project directory and run codex. Describe what you want in plain language, such as adding a function, fixing a failing test, or refactoring a module. Codex proposes changes and, depending on your approval settings, either applies them directly or waits for your confirmation. Start it on small, well-scoped tasks while you learn how it behaves before handing it anything larger. A solid daily-driver workstation keeps that loop snappy, and the popular developer desktops at Evetech are a sensible reference point if your current machine is the bottleneck.

Frequently Asked Questions

Do I need a paid ChatGPT plan to use Codex CLI?

You need either a qualifying ChatGPT plan or an OpenAI API key with credit. The ChatGPT sign-in folds Codex usage into your existing subscription, while the API key route bills against your API account separately.

Which operating systems does Codex CLI support?

Windows, macOS and Linux are all supported. The npm install method works identically across them, and there are platform-specific install scripts and prebuilt binaries on the GitHub releases page if you prefer.

Why do I get "command not found" after installing?

The global npm bin folder is not on your system PATH. Add it to your shell profile or reopen a fresh terminal, then run codex again.

Is it safe to let Codex run commands on my machine?

Codex has approval controls so you decide how much autonomy it gets. Keep approvals on for anything that modifies files or runs shell commands until you trust a given workflow, and work inside version control so you can always roll back.

Building a setup that can keep up with local AI agents? Explore the AI-ready PC range at Evetech and get a machine that runs Codex, builds and tests without breaking stride.