OpenAI's Codex CLI has evolved from the lightweight terminal agent launched in April 2025 into the central hub of an entire coding platform — spanning terminal, IDE extension, cloud environment, and desktop app. Two things have changed enough to matter for anyone installing it today: OpenAI now ships an official standalone installer that removes the Node.js dependency entirely, and the model lineup has moved on to the GPT-5.6 family — Sol, Terra, and Luna.
Because most readers arrive here to install the thing and get moving, the install steps come first. Below you will find a 60-second quick start, then every supported installation method ranked in the order OpenAI itself recommends them, followed by community options and the deeper configuration material — models, sandbox and approval modes, MCP servers, agent skills, and enterprise security.
Quick Start
Install Codex CLI on Linux in 60 Seconds
The fastest supported path on Ubuntu and other Linux distributions is OpenAI's official standalone installer. No Node.js required.
# 1. Install (official installer — macOS and Linux)
curl -fsSL https://chatgpt.com/codex/install.sh | sh
# 2. Verify
codex --version
# 3. Open a project and sign in
cd your-project-directory
codexOn first run, choose Sign in with ChatGPT to use Codex through your Plus, Pro, Business, Edu, or Enterprise plan. Re-running the same install command updates an existing installation.
Important: the package name is @openai/codex
If you install via npm, use npm install -g @openai/codex. The unscoped codex package on npm is an unrelated project with no connection to OpenAI — it installs without error and then does nothing useful. This is the single most common Codex CLI installation mistake.
Installation Methods, Ranked
OpenAI documents four supported ways to install Codex CLI. They are listed below in the order OpenAI presents them in its own documentation and repository — official and recommended first, then community-maintained options that are not operated by OpenAI.
Official Method 1 — Standalone Installer (Recommended)
This is the path OpenAI leads with for macOS and Linux. It downloads a self-contained binary, so there is no Node.js or package manager dependency to maintain:
curl -fsSL https://chatgpt.com/codex/install.sh | shTo upgrade later, run exactly the same command — the installer replaces the existing binary in place.
Official Method 2 — npm
Best if your team already standardizes developer tooling through Node.js and npm, or you want to pin a specific version:
npm install -g @openai/codex
# Pin or upgrade to a specific release
npm install -g @openai/codex@latestThe published package declares a minimum of Node.js 16, but install it on a current LTS release (Node 20 or 22) for the smoothest experience. Ubuntu's default repositories often ship an older Node.js, so install from NodeSource if needed:
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
node --versionNever use sudo with npm install -g
If you hit EACCES permission errors, configure a user-level npm prefix instead of reaching for sudo: mkdir -p ~/.npm-global && npm config set prefix ~/.npm-global, then add export PATH="$HOME/.npm-global/bin:$PATH" to your ~/.bashrc and run source ~/.bashrc.
Official Method 3 — Homebrew
Supported on Linux for teams already using Homebrew as their cross-platform package manager:
brew install --cask codex
# Upgrade
brew upgrade --cask codexOfficial Method 4 — Direct Binary Download
Best for air-gapped environments, golden images, container builds, or any situation where you want a pinned, auditable artifact. Download the appropriate archive from the project's GitHub Releases page:
# x86_64 (most Ubuntu servers and desktops)
codex-x86_64-unknown-linux-musl.tar.gz
# ARM64 (Ampere, Graviton, Raspberry Pi 4/5, etc.)
codex-aarch64-unknown-linux-musl.tar.gz
# Extract, rename to "codex", make executable, put it on PATH
tar -xzf codex-x86_64-unknown-linux-musl.tar.gz
mv codex-x86_64-unknown-linux-musl codex
chmod +x codex
sudo mv codex /usr/local/bin/Each archive contains a single binary with the platform baked into the filename, so rename it to codex after extracting. Because these builds are statically linked against musl, they run across distributions without glibc version headaches.
| Method | Status | Best For | How To Update |
|---|---|---|---|
| Standalone installer | Official — recommended | Most users; no Node.js dependency | Re-run the install command |
| npm | Official | Node-standardized teams; version pinning | npm install -g @openai/codex@latest |
| Homebrew | Official | Cross-platform Homebrew shops | brew upgrade --cask codex |
| Direct binary | Official | Air-gapped, golden images, containers | Download and replace the binary |
| Community packages / source build | Unofficial | Distro purists; contributors | Per packager / rebuild from source |
Community and Unofficial Methods
These are not maintained or endorsed by OpenAI. They can be perfectly workable, but they lag official releases and carry supply-chain considerations that matter in a business environment:
- Community distro packages: User-maintained packages such as Arch's AUR entries and various third-party repositories. Convenient on those distributions, but update on the packager's schedule, not OpenAI's.
- Third-party install scripts and wrappers: Blog-published one-liners and convenience wrappers. Treat any
curl | shfrom a non-OpenAI domain as untrusted code execution and read it first. - Building from source: Codex CLI is open-source and Rust-based, so you can clone the repository and build it yourself. This is the right path for contributors or teams that must compile everything in-house, at the cost of managing a Rust toolchain.
- Unofficial container images: Community Docker images bundling Codex CLI. Useful for CI experimentation; verify the provenance and pinned version before relying on one.
Recommendation for business environments
Standardize on one official method across the team — the standalone installer for developer workstations, or a pinned direct binary for build agents and images. Mixing installation methods on the same machine is the most common cause of version confusion and command not found PATH conflicts.
Verify the Installation
codex --version
which codexIf the shell reports command not found, the binary is installed but not on your PATH. For npm installs with a user-level prefix, confirm ~/.npm-global/bin is in your PATH; for direct binary installs, confirm the file landed in /usr/local/bin and is executable.
Authenticate
Launch Codex in a project directory to complete first-run authentication:
cd your-project-directory
codexSign in with ChatGPT (recommended): Select "Sign in with ChatGPT." Codex starts a temporary local OAuth server and opens your browser. After you complete the flow, return to the terminal — tokens are stored automatically. This is the simplest onboarding and gives you Codex model access through your existing Plus, Pro, Business, Edu, or Enterprise plan.
API key: For CI/CD pipelines, headless servers, and environments without a browser, use an API key instead:
# Current session
export OPENAI_API_KEY="sk-your-api-key-here"
# Persist across sessions
echo 'export OPENAI_API_KEY="sk-your-api-key-here"' >> ~/.bashrc
source ~/.bashrcGenerate keys at platform.openai.com/api-keys. Model availability differs between subscription sign-in and API-key access, so confirm which models your key can reach before standardizing a headless workflow. Never commit API keys to version control or store them in plain text inside a repository — use your CI platform's secret store instead.
Prerequisites and Environment Notes
- Ubuntu 20.04+ (22.04 LTS or 24.04 LTS recommended for business deployments); the musl binaries also run on other mainstream distributions
- Node.js — only required for the npm method. The standalone installer, Homebrew, and direct binary paths have no Node dependency
- Git 2.23+ recommended for repository-aware operations
- Outbound HTTPS to OpenAI endpoints — all model inference runs in the cloud
- A ChatGPT plan (Plus, Pro, Business, Edu, or Enterprise) or an API key
- 2GB+ RAM — the CLI itself is lightweight because inference is remote
Note: Network Requirements
Codex CLI requires outbound HTTPS access to OpenAI's API endpoints for all AI operations. Organizations with restrictive firewall policies must allow this traffic. If web search is enabled, additional outbound access may be needed depending on configuration.
✓ Key Takeaways
- The official installer is now the recommended path —
curl -fsSL https://chatgpt.com/codex/install.sh | shinstalls and updates Codex CLI on Linux with no Node.js dependency. - Four official methods, in order: standalone installer, npm (
@openai/codex), Homebrew (brew install --cask codex), and direct binary download from GitHub Releases. Community packages and source builds are unofficial. - GPT-5.6 is the current family — Sol (flagship), Terra (balanced everyday work), and Luna (fast and affordable), with per-model reasoning effort on paid plans. GPT-5.3-Codex is deprecated for ChatGPT sign-in.
- ChatGPT account sign-in is the simplest authentication — API keys remain available for CI/CD and headless environments.
- Sandbox and approval modes are security controls — Linux isolation via bubblewrap, read-only policies, and approval gates determine the agent's blast radius.
What Codex CLI Does in 2026
Codex CLI is an open-source, Rust-based coding agent that runs locally in your terminal and connects to OpenAI's cloud models for inference. Your code stays on your machine and executes locally; the reasoning that interprets prompts and generates solutions happens in OpenAI's cloud. This hybrid architecture lets Codex use models far more powerful than anything that would run on a development workstation, while leaving developers in control of what actually executes in their environment.
The product now spans four surfaces, all connected through your ChatGPT account so context moves between them:
- Codex CLI: The open-source terminal agent. Reads, edits, and runs code locally with configurable approval modes and sandbox isolation.
- Codex IDE Extension: A VS Code extension bringing the same agentic capabilities into the editor, sharing MCP and configuration with the CLI.
- Codex Cloud: An asynchronous web environment where tasks run in isolated containers with your codebase preloaded.
- Codex App: A dedicated desktop application with full model selection, skills, and MCP support.
Current capabilities include natural language code generation and editing across multiple files, codebase understanding, multimodal input (screenshots, wireframes, diagrams), Git-aware operations, MCP server integration, agent skills for repeatable workflows, mid-turn steering, built-in web search, automated code review, and thread resume across restarts [OpenAI].
The Model Lineup
The model lineup changed materially in mid-2026. Codex now runs on the GPT-5.6 family, which uses a tiered naming scheme: the number identifies the generation, while Sol, Terra, and Luna are durable capability tiers that advance on their own cadence. Switch models mid-session with the /model command.
| Model | Best For | Notes |
|---|---|---|
| GPT-5.6 Sol | Hardest engineering work, deepest reasoning | The flagship and strongest tier. The only model that unlocks the new max reasoning-effort setting and ultra mode. API pricing $5 input / $30 output per 1M tokens. |
| GPT-5.6 Terra | Everyday development — the balanced workhorse | Performance competitive with GPT-5.5 at roughly half the cost. The practical default for most sessions. API pricing $2.50 input / $15 output per 1M tokens. |
| GPT-5.6 Luna | Fast, high-volume, latency-sensitive or budget work | The fastest and most affordable tier. API pricing $1 input / $6 output per 1M tokens. |
| GPT-5.5 and GPT-5.4 | Teams pinned to a known-good baseline | Previous generations that remain selectable for reproducibility and regression comparison. |
| Spark | Real-time interactive editing | Ultra-low-latency variant for quick edits and conversational iteration. |
Plan availability differs by tier: Free and Go users get GPT-5.6 Terra, while Plus, Pro, Business, and Enterprise users can choose among Sol, Terra, and Luna and set a reasoning-effort level for each [OpenAI]. Note that the GPT-5.3-Codex models are deprecated in Codex when you sign in with ChatGPT — if your notes, scripts, or team documentation still reference them, update those to a GPT-5.6 tier.
Understanding Approval Modes and Sandbox
Codex CLI provides granular control over what the AI agent can do on your system. These aren't just preferences — for enterprise environments, they're security controls that determine the agent's blast radius.
Codex CLI Approval Modes
Read Only
Codex reads and analyzes code but cannot modify files or execute commands. Use for exploration and planning.
Auto (Default)
Full workspace access for reads, edits, and commands. Requires approval for operations outside the workspace or network access.
Full Access
Unrestricted autonomy including file system access anywhere, command execution, and network operations. Use only in isolated environments.
Switch modes dynamically with /approvals read-only, /approvals auto, or /approvals full-access. On Linux, Codex now uses bubblewrap for sandbox isolation — providing configurable read-only access policies, shell environment controls, and restrictions on what the agent can reach. Configure these in ~/.codex/config.toml:
# Control which env vars Codex forwards to spawned commands
[shell_environment_policy]
include_only = ["PATH", "HOME"]
# Web search configuration
web_search = "cached" # "cached" (default), "live", or "disabled"Essential Commands and Configuration
| Command | Purpose |
|---|---|
| codex | Start an interactive TUI session in the current directory |
| codex "prompt" | Start a session with an initial prompt |
| codex exec "task" | Non-interactive execution for automation and CI/CD |
| /model | Switch between GPT-5.6 Sol, Terra, Luna, and earlier generations |
| /approvals | Switch approval mode (read-only, auto, full-access) |
| /mcp | View active MCP server status and tools |
| /skills | View and invoke agent skills |
| /statusline | Configure which metadata appears in the TUI footer |
| /debug-config | Debug configuration with source provenance for each value |
| /m_update, /m_drop | Manage Codex's memory system (update or drop memories) |
| codex mcp add | Add an MCP server (stdio or HTTP) |
| codex features list | View available feature flags (unified_exec, shell_snapshot, etc.) |
| npm update -g @openai/codex | Update to the latest version |
Codex also supports steer mode — press Enter while Codex is running to inject new instructions into the current turn, or press Tab to queue a follow-up prompt for the next turn. This enables real-time course correction without canceling and restarting. The @ key opens fuzzy file search in the composer, and prefixing a line with ! runs a local shell command directly.
Setting Up MCP Servers
The Model Context Protocol connects Codex to external tools, documentation, and services. MCP configuration lives in ~/.codex/config.toml and is shared between the CLI and IDE extension — configure once, use everywhere.
Adding Context7 for Real-Time Documentation
# Add Context7 for up-to-date library documentation
codex mcp add context7 -- npx -y @upstash/context7-mcp
# Add Playwright for browser automation
codex mcp add playwright -- npx @playwright/mcp@latest
# View all configured MCP servers
codex mcp --helpInside a Codex session, use /mcp to view active servers and their available tools. MCP servers can also be configured directly in config.toml for more control:
[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp"]
[mcp_servers.openaiDeveloperDocs]
type = "streamable_http"
url = "https://developers.openai.com/mcp"Codex also supports Streamable HTTP servers (remote MCP servers accessed via URL) and OAuth authentication for MCP servers that require it. If your OAuth provider requires a static callback URI, set mcp_oauth_callback_port in config.toml.
For organizations deploying AI development tools across teams, MCP server configurations can be scoped to projects via .codex/config.toml in the project root (trusted projects only), ensuring all team members access the same integrations.
Agent Skills: Repeatable Workflows
Skills package instructions, resources, and optional scripts so Codex can follow complex workflows reliably. They use progressive disclosure — Codex starts with each skill's metadata and loads full instructions only when needed.
A skill is a directory with a SKILL.md file containing a name, description, and instructions. Skills can be stored at the repository level (.agents/skills/), user level, or system level. Codex detects skill changes automatically.
# View available skills
/skills
# Invoke a skill explicitly with $
> $my-skill Fix the authentication flow
# Skills can also be implicitly invoked when your prompt matches the skill descriptionSkills can declare MCP server dependencies, so enabling a skill automatically ensures the required tools are available. For teams, sharing skills through version control creates consistent, auditable workflows that don't depend on individual developer configurations.
Enterprise Security Considerations
Deploying an AI coding agent that sends code context to cloud services for inference requires security planning that goes beyond traditional development tools. Codex CLI's architecture — local execution with cloud-based reasoning — creates specific requirements for organizations managing sensitive code.
- Network controls: Whitelist api.openai.com in firewall configurations. If web search is enabled, additional outbound access may be needed. Monitor outbound API traffic for anomalous patterns.
- Data privacy: Review OpenAI's data usage policies for your subscription tier. Business and Enterprise plans provide enhanced data privacy commitments. Restrict Codex to non-sensitive codebases initially and implement code classification policies for AI tool usage.
- API key management: Implement rotation policies (90-day maximum). Use separate keys for different environments. Store keys in environment variables or secrets management services — never in version control.
- Sandbox configuration: Use the Linux bubblewrap sandbox and shell_environment_policy to restrict what Codex can access. Configure read-only access for exploratory work. Use auto mode for routine development and reserve full-access for isolated test environments only.
- Code review requirements: Require human review for all AI-generated commits. Codex includes a built-in code review feature that can catch issues before shipping, but it should supplement rather than replace human review processes.
- Compliance evaluation: Assess Codex usage against organizational requirements including HIPAA, CMMC, and SOC 2 frameworks. Document AI tool usage in security policies and maintain audit logs of Codex operations.
- Enterprise admin controls: Organizations can use
requirements.tomlto restrict web search modes, define network constraints, and enforce approval policies across the team.
Troubleshooting Common Issues
▶ "Command not found" after installation
Your shell hasn't picked up the npm global bin path. Fix with:
npm config get prefix
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc▶ EACCES permission errors during npm install
Configure npm to use a user-owned directory rather than using sudo:
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH="~/.npm-global/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
npm i -g @openai/codex▶ Authentication browser issues on headless servers
Copy the authentication URL displayed in the terminal and open it on a device with a browser. Alternatively, use API key authentication for headless environments where browser-based OAuth isn't feasible.
▶ MCP servers not connecting
Required MCP servers now fail fast during session start rather than continuing in a broken state. Check your configuration:
- Verify config with
/mcpinside a Codex session - Ensure required dependencies (Node.js for npx-based servers) are installed
- Check
~/.codex/config.tomlfor syntax errors - For OAuth-based MCP servers, run
codex mcp login server-name
Sources
- OpenAI. "Codex CLI." Developer Documentation, 2026. developers.openai.com/codex/cli
- OpenAI. "Model Context Protocol." Codex Documentation, 2026. developers.openai.com/codex/mcp
- OpenAI. "GPT-5.6: Frontier intelligence that scales with your ambition." OpenAI Blog, 2026. openai.com/index/gpt-5-6
- OpenAI. "A preview of GPT-5.6 Sol, Terra and Luna." OpenAI Help Center, 2026. help.openai.com
- OpenAI. "Introducing upgrades to Codex." OpenAI Blog, 2025. openai.com/index/introducing-upgrades-to-codex
- OpenAI. "Codex Changelog." Developer Documentation, 2026. developers.openai.com/codex/changelog
- OpenAI. "openai/codex." GitHub Repository, 2026. github.com/openai/codex
Related Resources
Strategic guidance for AI development tool evaluation, deployment planning, and governance frameworks.
Security framework development for organizations deploying AI coding agents with cloud-based inference.
Companion guide covering Anthropic's Claude Code CLI with MCP server configuration and enterprise deployment.
Model comparison covering the AI engines powering Codex CLI and Google Antigravity.
Ready to Deploy AI Coding Tools Across Your Development Team?
Codex CLI's combination of powerful cloud-based models, configurable sandbox isolation, and MCP server integration makes it a compelling option for organizations looking to accelerate development velocity. ITECS provides the cybersecurity expertise and AI consulting capabilities needed to deploy these tools with the governance controls that enterprise environments demand.
