Elena' s AI Blog

Getting Started with Codex CLI

21 Jan 2026 (updated: 05 Oct 2026) / 22 minutes to read

Elena Daehnhardt

Midjourney 7 AI-art. March 2026. Prompt: a female developer works with Codex AI CLI, high-tech magazine, color accents, light background, HD

If you click an affiliate link and subsequently make a purchase, I will earn a small commission at no additional cost (you pay nothing extra). This is important for promoting tools I like and supporting my blogging.

I thoroughly check the affiliated products' functionality and use them myself to ensure high-quality content for my readers. Thank you very much for motivating me to write.



TL;DR:
  • Codex CLI is OpenAI's coding agent for your terminal. Install via the official curl installer script (Mac/Linux), brew (Mac), or npm (universal). Authenticate with ChatGPT subscription or API key. Start in read-only mode to explore safely. Part 1 of a 4-part series.

Previous: Part 4 — Codex CLI Part 4: Advanced Operations, Troubleshooting, and Team Patterns

Next: Part 2 — Codex CLI Part 2 — Security Controls & Safe Editing

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.

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:

  1. Terminal/Command line access
  2. An OpenAI account (ChatGPT subscription or API access)
  3. Node.js — only if you install via npm; the official installer script below does not need it

Quick Install: The Official Installer Script

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).

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:

codex-cli 0.87.0

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.

You've hit a Deep Dive tutorial.

I spend dozens of hours researching, coding, and breaking things to write these guides. This content is free, but reserved for my subscriber community. Drop your email below to unlock this guide (and all past/future deep dives):

Already a subscriber? Use the magic link from your last newsletter, or reset your password.

New subscribers get an inbox mail: Set a password to unlock articles. The form does not log you in — use the same email afterwards.

desktop bg dark

About Elena

Elena, a PhD in Computer Science, simplifies AI concepts and helps you use machine learning.




Citation
Elena Daehnhardt. (2026) 'Getting Started with Codex CLI', daehnhardt.com, 21 January 2026. Available at: https://daehnhardt.com/blog/2026/01/21/how-i-use-codex-cli/
All Posts