Using Codex CLI on macOS (Apple Silicon)#
Codex CLI is the terminal interface for OpenAI Codex.
Codex supports two authentication methods:
-
ChatGPT account
- Uses ChatGPT plan limits (Free, Plus, Pro)
- No API key required
-
OpenAI API key
- Uses OpenAI Platform API billing
- Requires an API key
- Usage is charged against API credits
You can switch between both methods.
1. Installation#
Install Codex CLI via Homebrew Cask:
brew install --cask codexVerify:
which codex
codex --version2. Configuration#
Codex stores configuration in:
~/.codex/Important files:
| File | Purpose |
|---|---|
config.toml |
Main configuration |
auth.json |
Authentication state |
logs_*.sqlite |
Conversation logs |
state_*.sqlite |
Internal state |
Edit configuration:
nano ~/.codex/config.toml3. MCP Server Configuration#
MCP servers are managed through the centralized Git-backed pipeline documented in:
Check MCP and system configuration:
codex doctor4. Authentication#
Option A — ChatGPT Account Login#
Uses your ChatGPT account limits.
Login:
codex loginCheck status:
codex login statusExample:
Logged in using ChatGPTCheck Codex usage:
/statusOnline usage page:
https://chatgpt.com/codex/settings/usageOption B — OpenAI API Key Login#
Uses OpenAI API billing.
Create an API key:
https://platform.openai.com/api-keysStore the key in 1Password.
Add it to your shell environment:
nano ~/.zshrcAdd to ~/.zshrc:
alias codexa='printf "%s" "$OPENAI_API_KEY SEE 1Passoed" | codex login --with-api-key'Then switch to API authentication:
codexa5. Switching Authentication Methods#
Check current login:
codex login statusSwitch to ChatGPT account:
codex loginSwitch to API key:
codexa6. Checking Usage#
Inside Codex:
/statusChatGPT usage:
https://chatgpt.com/codex/settings/usageAPI usage:
https://platform.openai.com/usage7. Diagnostics#
Run:
codex doctorCheck configuration:
cat ~/.codex/config.toml8. GPT-6 Missing from the ChatGPT Desktop App or Codex CLI#
If GPT-6 models appear in ChatGPT on the web but are missing from the local Codex model picker, check whether the local Codex configuration routes requests through Ollama or loads a custom model catalog.
In ~/.codex/config.toml, remove stale active settings such as:
openai_base_url = "http://127.0.0.1:11434/api/codex/v1"
model_catalog_json = "/path/to/an/ollama-model-catalog.json"These settings can make the OpenAI model picker use the local Ollama endpoint and catalog. After removing them, restart the ChatGPT desktop app. For Codex CLI, restart its background app server so it reloads the configuration:
codex app-server daemon restartThis may disconnect active CLI sessions. Reopen the CLI and use /model (singular) to choose a model. To check the CLI’s bundled catalog without printing full model metadata:
codex debug models --bundled | jq -r '.models[].slug'The separate ollama-launch profile intentionally selects an Ollama provider and custom catalog. Continue using it for local models; omit that profile when you want the standard OpenAI model catalog.
9. Quick Reference#
| Command | Description |
|---|---|
codex |
Start Codex CLI |
codex --version |
Show version |
codex login |
Login with ChatGPT account |
codex login status |
Show authentication mode |
codex-api |
Switch to API key authentication |
codex doctor |
Diagnose installation |
/status |
Show current session information |
Notes#
Codex CLI uses the same installation for both authentication methods.
| Authentication | Billing source |
|---|---|
| ChatGPT login | ChatGPT plan limits |
| API key | OpenAI Platform API credits |
Use:
- ChatGPT login when you want to use included Codex access.
- API key login when you want API billing and usage tracking.