Guides

How to install Codex CLI on a Mac

By Diego Partida, who makes Tendeck · Updated

Short answer

Run one of the three official installs: curl -fsSL https://chatgpt.com/codex/install.sh | sh, npm install -g @openai/codex or brew install --cask codex. Then run codex in your project folder and pick Sign in with ChatGPT, or use an API key. ChatGPT sign-in draws on your plan's Codex usage; an API key is billed at API rates and has no cloud features.

Before you start

Codex is OpenAI’s coding agent. The CLI runs in your terminal, reads your repository, edits files and runs commands, asking for approval when it needs to go further. It’s open source under Apache-2.0, in the openai/codex repository.

You need two things:

Facts in this guide come from OpenAI’s Codex CLI docs, its pricing page and the GitHub README, checked November 14, 2026. OpenAI moved its Codex docs from developers.openai.com to learn.chatgpt.com this year, so old links redirect there.

Install it

OpenAI lists three ways to install the CLI on macOS. Pick one.

The standalone installer, for macOS and Linux:

curl -fsSL https://chatgpt.com/codex/install.sh | sh

npm, if you already have Node.js:

npm install -g @openai/codex

Homebrew:

brew install --cask codex

Keep a single install. Two copies on your PATH make it hard to tell which one runs when you type codex.

First run: sign in

Open a terminal in your project folder and run:

codex

The first time, Codex asks how to sign in. Choose Sign in with ChatGPT, or another method such as an API key.

With ChatGPT, Codex draws on your plan. OpenAI’s pricing page lists “Codex on the web, in the CLI, in the IDE extension, and on iOS” under Plus ($20 a month). Pro starts at $100 a month and Business at $20 per user a month billed annually. Free and Go list Codex in the desktop app, subject to rollout. Usage is counted in 5-hour windows, with weekly limits that may also apply, and the allowance depends on the model and the size of the task.

With an API key, Codex works in the CLI, the SDK and the IDE extension, billed at API rates. You don’t get the cloud features, such as GitHub code review or Slack.

Prices and plans change. Check the pricing page before you pick one.

How Codex keeps you safe by default

On a Mac, Codex runs commands inside an operating system sandbox (Seatbelt, through sandbox-exec). Its default preset is --sandbox workspace-write --ask-for-approval on-request: it reads, edits and runs commands inside your project, and asks before it writes outside it or uses the network. Folders like .git stay read-only even inside the workspace.

In the CLI, /permissions switches between Ask for approval, Approve for me and Full access. The flag --dangerously-bypass-approvals-and-sandbox (alias --yolo) turns off both the sandbox and the approvals. Keep it for throwaway environments.

Give it an AGENTS.md

Codex reads AGENTS.md before it does any work. It looks in three places, in this order:

  1. A global file at ~/.codex/AGENTS.md, for rules you want everywhere.
  2. One file per folder, from the repository root down to the folder you’re in.
  3. The files it finds are joined root first, up to 32 KiB by default.

Run /init inside Codex to have it draft one for the project. A good AGENTS.md says how to install dependencies, how to run the tests, and what not to touch.

Pick a conversation back up

Codex keeps your conversations. To continue the latest one in the current folder:

codex resume --last

codex resume on its own shows a picker of recent ones. For scripts, codex exec "<prompt>" runs a task without the interactive screen and prints the final message.

Put Codex on a Tendeck card

This is the maker’s part, so weigh it accordingly. Tendeck is a native Mac app that runs coding agents on cards of one board, and Codex is one of the two agents it knows best:

Tendeck doesn’t include Codex or a ChatGPT plan: you install the CLI as above and sign in with your own account. See Codex on Tendeck for the details.

Related: Codex on Tendeck · Claude Code vs Codex · Run Claude Code and Codex together · Run several agents in parallel

Questions people ask

Is Codex CLI free?

The CLI itself is open source under Apache-2.0. Using it needs a ChatGPT plan that includes Codex or an OpenAI API key. OpenAI's pricing page lists the CLI under Plus and up; Free and Go list the desktop app, subject to rollout (checked November 14, 2026).

Which install should I pick?

Any of the three works. Use the one that matches how you manage other tools: Homebrew if you use it for everything, npm if your Node setup is already in order, or the standalone installer if you want neither. Keep only one, so codex always means the same binary.

Can Codex use the internet or change files outside my project?

Not by default. OpenAI's docs say the local CLI starts with no network access and write access limited to the active workspace. It asks before going further.

Can I run Codex next to Claude Code?

Yes. They keep separate logins, configuration and limits. The guide on running Claude Code and Codex together covers sharing instructions and keeping them off each other's files.

Tendeck lives on your Mac

You’re not on a Mac right now. Get the link by email and start the 7-day trial when you’re at your Mac: no card.

One email with the link. No list, no follow-ups.

Download the .dmg anyway