Elena' s AI Blog

Getting Started with Codex CLI

21 Jan 2026 (updated: 24 Aug 2026) / 19 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 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: what it is, how to install it, and how to take your first steps safely.

What Is Codex CLI?

Before we jump into installation, let me explain what Codex CLI actually is and why it is different from using ChatGPT in a browser.

The Core Concept

Codex CLI is a coding agent that runs locally in your terminal. When you start it in a project directory, it can:

  • Read all the files in that directory
  • Understand your project structure
  • Propose changes to files
  • Run commands (with your approval)
  • Show you diffs before applying changes

Think of it as having an experienced developer pair-programming with you, but one who works incredibly fast and has read your entire codebase. See the [official Codex CLI documentation][1] for the complete command reference.

How It Differs from ChatGPT

Here is a helpful comparison:

ChatGPT in a browser:

  • Great for discussing ideas and getting code snippets
  • You copy and paste code back and forth
  • It does not know about your actual project files
  • Every conversation starts fresh

Codex CLI:

  • Understands your entire repository context
  • Can directly edit your files (with approval)
  • Can run tests and commands in your environment
  • Maintains conversation history across sessions

The key difference is context and action. Codex CLI sits next to your actual code and can help you work with it directly.

Codex CLI vs ChatGPT: Quick-Reference

Dimension ChatGPT in Browser Codex CLI in Terminal
Project context None — you paste snippets manually. Full repo read; understands file structure.
File editing You copy-paste suggestions back manually. Proposes and applies diffs with your approval.
Command execution Cannot run commands. Runs pytest, ruff, build scripts in your env.
Session memory Resets every conversation. Maintains history; resumable across sessions.
Safety model No guardrails on outputs. Approval modes: read-only → auto → full access.
Best for Ideas, snippets, brainstorming. Repo-native edits, QA, automation, refactors.

The Safety Model

Here is what I appreciate most: Codex CLI is built with safety guardrails. By default, it asks for permission before:

  • Editing files
  • Running commands
  • Making network requests

You control how much autonomy to give it through “approval modes” (which I will explain in Part 2). This means you can start conservatively and gradually trust it more as you become comfortable.

Installation Guide

🔒 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