01What Codex is
Codex is a coding agent made by OpenAI. You tell it what to do in Terminal in plain language, and it reads your code, edits files and runs commands on its own. Besides the Terminal version, you can also use Codex in the ChatGPT desktop app for Mac, and there are extensions for VS Code and Cursor. This guide covers the Terminal version.
- Sign in with a ChatGPT account: the OpenAI Help Center says every ChatGPT plan includes Codex, including the free plan, but usage limits differ. Check the Help Center for details.
- You can also use an OpenAI API key, billed at API prices.
02Install it with one command
Open Terminal and run the official install command:
curl -fsSL https://chatgpt.com/codex/install.sh | sh
It installs codex into your own ~/.local/bin folder and doesn’t need admin rights. When it finishes, close Terminal, open it again and run codex --version. If you see a version number, it’s installed.
- You can also install it with Homebrew: brew install --cask codex.
- Or with npm: npm install -g @openai/codex.
Homebrew is already installed on NexMini Macs. All of the methods above install into your own account, so a standard account is enough.
03Sign in
- In Terminal, go to your project folder (cd folder-path) and run codex.
- The first time, it asks you to sign in. Choose “Sign in with ChatGPT” and sign in to your ChatGPT account in the browser.
- If you are connected to a remote Mac over SSH and can’t open a browser there: run codex login --device-auth and finish signing in with a browser on another device (OpenAI marks this as a beta feature).
- To sign in with an API key: first set the key as the environment variable OPENAI_API_KEY, then run printenv OPENAI_API_KEY | codex login --with-api-key.
- To check your sign-in status: codex login status. To sign out: codex logout.
04What it can touch
- In a Git project, the default is Auto: it can read and write the project folder, and asks you first before anything that needs more access.
- In a folder that isn’t a Git project, the default is read-only: it looks but doesn’t change anything.
- Type /permissions in Codex to switch at any time.
Codex also has flags that remove all limits (such as --yolo), letting it run any command without asking. If you really want to use them, only do it on a separate machine, not on your own computer with important files on it.
05First use: start with a small task
- Type /init to have Codex create an AGENTS.md. This is a project guide written for Codex: how to run the project, how to test it, what conventions to follow. It reads this file before every task.
- Describe a small task in one sentence, for example “Add a Remember me option to the login page and add tests for it”.
- When it’s done, type /diff to see what changed, and commit only if you’re happy with it.
- To have it check your code, type /review.
| Command | What it does |
|---|---|
| /model | Switch models |
| /status | Show the current status |
| /new | Start a new conversation |
| /resume | Continue an earlier conversation |
| /compact | Compress the conversation when it gets too long |
06Keep it running on a remote Mac, and how to update
- Run it inside a tmux session. It keeps working after you close the window or disconnect. For details, see the guide “How to keep an AI agent running 24/7 on a Mac”.
- To use it in a script or a scheduled job: codex exec "your instruction". It does the task once and exits, without opening the interactive screen.
- To update: run codex update, or run the install command again. If you installed with Homebrew or npm, update with that tool.
To compare it with Claude Code, see the guide “How to install Claude Code on a Mac, and how it differs from Codex”.

