This is Part 1 of the Codex CLI series. We’ll cover installation, authentication, and your first session. Future posts will explore workflows, best practices, and advanced features.
Codex CLI Overview: Terminal-Based AI Coding Agent
Today I want to introduce you to Codex CLI—a tool that has genuinely changed how I work with both code and writing.
In short, Codex CLI is OpenAI’s coding agent for the terminal: you install one binary, sign in, and talk to it from the command line inside your project. The sections below show how to install Codex CLI on macOS, Linux and Windows, and what to do first.
If you have ever wished you could have an AI assistant that actually understands your project, can read your files, and help you make changes right from your terminal, Codex CLI is exactly that. It is not just another chatbot; it is designed to work inside your repository, understanding your code structure and helping you improve it safely.
In this series, I will walk you through everything you need to know to use Codex CLI productively. Today’s post covers the fundamentals: how to install it, what it is, and how to take your first steps safely.
Installation Guide
Codex CLI works on macOS, Linux, and Windows. The installation method varies slightly by platform, so I will walk through each one.
Prerequisites
Before installing, you need:
- Terminal/Command line access
- An OpenAI account (ChatGPT subscription or API access)
- Node.js — only if you install via npm; the official installer script below does not need it
Quick Install: Codex CLI Install Script for Linux, macOS and Windows
OpenAI now ships a one-line installer that works the same way on macOS and Linux, and does not require Node.js or a package manager at all. If you just want Codex CLI running in the next thirty seconds, this is the fastest route:
# macOS / Linux
curl -fsSL https://chatgpt.com/codex/install.sh | sh
# Windows PowerShell
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
The script downloads the right prebuilt binary for your platform and puts codex on your PATH. Verify it worked with codex --version, then update any time with codex update — that command works regardless of which install method you used.
If you would rather manage Codex through a package manager you already use — Homebrew keeping it updated via brew upgrade, or npm alongside your other global tools — the platform sections below cover both.
How to Install Codex CLI on macOS (Apple Silicon and Intel)
Beyond the quick installer script above, Mac users have two package-manager options: Homebrew (easiest to keep updated) or npm (universal).
Option 1: Homebrew (Recommended)
If you use Homebrew, this is the simplest path:
# Install Codex CLI
brew install --cask codex
# Verify installation
codex --version
# Launch it
codex
Why this works well: Homebrew handles all dependencies and keeps Codex updated automatically when you run brew upgrade. Cask details: [Homebrew Formulae: codex][3].
Option 2: npm
If you prefer npm or already manage tools through Node:
# Install globally via npm
npm install -g @openai/codex
# Verify installation
codex --version
# Launch it
codex
When to use this: If you manage development tools through npm or want consistent installation across all your machines. Package details: [@openai/codex on npm][2].
My Codex CLI version that I have used to write this post is:
The Linux and Windows routes, fixes for common install errors, and what Codex CLI actually is follow below.
What Is Codex CLI?
🔒 Subscribe to keep reading.
Authentication
🔒 Subscribe to keep reading.
Your First Session
🔒 Subscribe to keep reading.
Codex CLI Practice Checklist: Recommended First Steps
🔒 Subscribe to keep reading.
Codex CLI Series Roadmap: Parts 2–4
🔒 Subscribe to keep reading.
Codex CLI Adoption Strategy: Building Trust Gradually
🔒 Subscribe to keep reading.