Omarchy Apps Sponsor

AI coding agent guide

OpenAI Codex CLI on Omarchy

OpenAI's terminal coding agent — describe a task, and it reads code, edits files, and runs commands.

Reviewed 2026-11-25 · independent editorial guide

Short answer

Install OpenAI Codex CLI with omarchy pkg add openai-codex, then run codex in your project folder. Sign in with ChatGPT or an API key; the safe default is workspace-write sandbox with on-request approvals.

OpenAI Codex CLI on Omarchy

OpenAI Codex CLI on Omarchy is OpenAI’s Apache-2.0 terminal coding agent: run codex in a project, describe the task, and it reads code, edits files, and runs commands, billed through your ChatGPT plan or an OpenAI API key.

TL;DR

omarchy pkg add openai-codex

Then cd ~/my-project and run codex. That installs Codex CLI v0.172.0-1 (189.9 MB download, 528.4 MB installed, depends on glibc). On first launch, sign in with ChatGPT or provide your own API key, then describe what you want done.

Getting started (5 minutes)

1. Sign in.

Run codex for the first time and it asks how you want to sign in. Sign in with ChatGPT uses the Codex usage included in your ChatGPT plan (Plus, Pro, Business, or Enterprise; the Free and Go plans include Codex only in the desktop app, not the CLI). Sign in with Device Code is for machines without a browser, like a server reached over SSH: you get a code to type on another device. Provide your own API key bills you per use on the OpenAI API instead of your plan. You can also sign in without starting a session with codex login, use codex login --device-auth on a headless machine, and check which method is active with codex login status. Sign out with codex logout.

2. Start with a read-only task.

Try: “Take a look at this project and explain its main directories.” Codex reads and searches the project before answering, so you see how it works before it edits anything. Then ask it to write an AGENTS.md with your project conventions, so future sessions follow your rules.

3. Three things worth doing in the first session:

  • Check the sandbox before you trust it. Codex splits safety into sandbox_mode (read-only, workspace-write, or danger-full-access) and approval_policy (on-request asks before each command or write). The safe default for daily work is workspace-write with on-request. Check and switch them inside a session with /permissions. Never use danger-full-access on a machine you care about: it turns the sandbox off entirely.
  • Run codex doctor when anything looks wrong. It checks the install, config, auth, and runtime in one pass and tells you what failed.
  • Use codex exec for scripted runs. It runs one prompt non-interactively, which is what you want in CI or a shell script. Note that approval prompts do not work the same way outside the TUI, so keep codex exec on a branch you can throw away.

Common issues & fixes

Sign-in hangs or loops on a server, or the browser callback never returns to the CLI

Use the device-code flow instead of the browser flow. The device-code flow is beta and you may need to enable it in your ChatGPT security settings first, or have your workspace admin enable it. If you are behind a proxy, the CLI may also fail to reach OpenAI even when your browser works.

Fix: Run codex login --device-auth — you get a one-time code to enter on another device. Behind a proxy, enable TUN mode in your proxy tool, or set HTTP_PROXY in the terminal before running codex. (OpenAgents install guide, Linuxize install guide)

The agent edits files outside the project, or runs commands you never asked for

This is the sandbox and approval settings, not a bug in one session. A documented incident (GitHub issue #59060, November 2026) saw Codex edit /etc/fstab on a server after a reboot task. Under read-only and workspace-write, writes outside the workspace fail with Read-only file system; only danger-full-access lets them through.

Fix: Set sandbox_mode = "workspace-write" and approval_policy = "on-request" in ~/.codex/config.toml, keep writable_roots to folders you really need, and never add /etc, /, or your whole home directory. If a folder is not trusted, Codex falls back to read-only. (AI Code With sandbox retest)

Your AGENTS.md rules get ignored, especially the ones near the bottom

Codex concatenates every AGENTS.md from your global ~/.codex/AGENTS.md through each directory down to your working directory, capped at 32 KiB by default. A long file is silently truncated past that budget, with no warning, so the rules you added last vanish first.

Fix: Keep each AGENTS.md under 4 KB and move detailed reference material into separate files the agent can read on demand. (Codex configuration anti-patterns)

You pinned a model in config.toml and the agent behaves differently than it used to, with no error

OpenAI retires models, and a pinned model that no longer exists silently falls back to the replacement, without the reasoning or context settings you calibrated for. GPT-5.2 and GPT-5.3-Codex were sunset in June 2026, and GPT-5.5 retired from Codex in October 2026.

Fix: Check your pinned model with /model inside a session and update config.toml to a current model (GPT-6.1 Sol was the default in early November 2026). Audit pinned models every few months. (Codex configuration anti-patterns, OpenAgents install guide)

You run codex and it says you have no Codex access, even though you have a ChatGPT account

The Free and Go plans include Codex only in the ChatGPT desktop app, not in the CLI. The CLI needs a paid plan (Plus, Pro, Business, or Enterprise) or an OpenAI API key with billing enabled.

Fix: If you are on Free or Go, either upgrade or sign in with an API key instead. Check your current method with codex login status. (OpenAgents install guide)

Pairs well with / If you hate this, try

Pairs well with

  • git (review diffs on a throwaway branch before merging), VS Code, Cursor, or Windsurf through the Codex IDE extension (it shares the CLI login), and Codex Cloud for long jobs you do not want to babysit.

If you hate this, try

  • If you hate paying OpenAI’s prices: OpenCode lets you bring your own key from 75+ providers, including free-tier keys, and Kimi Code CLI has a $0 membership tier. If you want the same terminal-agent shape with a different vendor’s models, Claude Code is the paid reference point.

Comparison: OpenAI Codex CLI vs Claude Code vs Kimi Code CLI vs OpenCode

OpenAI Codex CLIClaude Code (CLI)Kimi Code CLIOpenCode
PriceFree CLI; needs ChatGPT Plus $20/mo+ or pay-as-you-go API keyRequires Claude Pro $20/mo+Free CLI; Kimi membership from $15/mo or per-token API billingFree CLI; you pay your provider
Best forOpenAI’s own models, sandbox controls, Codex CloudThe strongest single-vendor models, no key jugglingA fast single-binary TUI with subagents and MCPPicking your own model per task, including free-tier keys
Omarchy installomarchy pkg add openai-codexnpm install -g @anthropic-ai/claude-codeomarchy pkg add kimi-codeomarchy pkg add opencode

Verdict: Pick Codex CLI if you already pay for a ChatGPT plan and want OpenAI’s models with real sandbox controls. Pick OpenCode if you want to choose your own model and provider, and Kimi Code CLI if you want a polished single-vendor agent with a free tier.

How to switch from Claude Code (~15 minutes per project)

  1. Export from Claude Code: your project instructions already live in CLAUDE.md. Codex reads AGENTS.md; copy the contents across, keeping it under 4 KB so nothing is silently truncated.
  2. Import into Codex: move MCP servers into ~/.codex/config.toml, and skills into the skills directory Codex reads. Set sandbox_mode = "workspace-write" and approval_policy = "on-request" before your first real task.
  3. What doesn’t transfer: chat history, Claude-specific slash commands and permission modes, and Claude Code’s GitHub Actions integration. Codex has its own cloud agent and IDE extension instead.
  4. Time estimate: takes about 15 minutes per project.

Open the OpenAI Codex CLI package

See the live version, upstream screenshot, requirements, source and exact Omarchy install command.

View OpenAI Codex CLI →

Frequently asked questions

Is Codex CLI free?

The CLI itself is free and Apache-2.0 licensed. Model access is not free: you need a paid ChatGPT plan (Plus $20/mo and up) or an OpenAI API key billed per token. The Free and Go plans include Codex only in the desktop app, not the CLI.

What is the difference between openai-codex, openai-codex-bin, and openai-codex-desktop?

All three are OpenAI’s Codex, in different packaging. openai-codex (this guide) is the official Omarchy repo build of the terminal CLI, v0.172.0-1. openai-codex-bin is the older prebuilt binary package (129.5 MB download, last updated 2026-10-09). openai-codex-desktop is the ChatGPT desktop app with Codex built in, a 484 MB download and 1.6 GB installed. Install the plain openai-codex for the terminal agent.

Do I need Node.js?

No, not with the Omarchy package: it installs the standalone binary. Node.js is only needed for the npm install path (npm install -g @openai/codex).

Where does Codex CLI store its config?

Config lives in ~/.codex/config.toml, credentials under ~/.codex/ (a file or the OS keyring, depending on the cli_auth_credentials_store setting). Project rules go in AGENTS.md at the project root, and a global ~/.codex/AGENTS.md applies everywhere.

Does it work offline or run a model locally?

No. Every prompt goes to OpenAI over the network. There is no bundled local model.

What is the default model?

GPT-6.1 Sol was the default in early November 2026. Check yours with /model inside a session, and do not trust a pinned model name from an old tutorial: retired models silently fall back to a replacement.

Official sources

Commands and fixes verified against official sources November 2026; on-machine verification pending.