Back to all posts
    Codex CLI Guide: Setup, Desktop, ChatGPT Work, MCP, and Daily Use

    Codex CLI Guide: Setup, Desktop, ChatGPT Work, MCP, and Daily Use

    A practical July 2026 guide to Codex CLI, Codex in ChatGPT desktop, ChatGPT Work, MCP, and shared agentic usage.

    July 10, 2026
    6 min read
    32 views
    by Iwo Szapar

    July 2026 note: CLI vs Desktop vs ChatGPT Work

    Codex is no longer just something people discover as a terminal tool. OpenAI's July 2026 rollout puts Chat, ChatGPT Work, and Codex together in the new ChatGPT desktop app. The CLI still matters, but it now sits beside the desktop Codex mode and the broader ChatGPT Work surface.

    SurfaceUse it forAvoid using it for
    Codex CLILocal repo edits, scripted checks, terminal workflows, reviews, tests, and repeatable command-line agent runs.Cross-app business workflows where the work is mostly docs, sheets, slides, and browser context.
    Codex in ChatGPT desktopDelegated repo work, local folders, Git review, terminals, developer tools, and multi-agent technical execution.Pure brainstorming that does not need files, tools, or a concrete artifact.
    ChatGPT WorkLonger business tasks across apps, files, web, docs, spreadsheets, slides, research, and deliverables.Unreviewed customer-facing changes, legal decisions, or finance actions without a human gate.

    The practical rule: use the CLI when the output should be a diff, test result, or repo artifact. Use desktop Codex when the same technical work benefits from visible worktrees, review, and local app context. Use ChatGPT Work when the task spans business systems and deliverables.

    OpenAI's Help Center also says Codex, ChatGPT Work, ChatGPT for Excel, and Workspace Agents can draw from the same agentic usage and credit pool where those features are available on your plan. That does not make every prompt expensive; it means longer-running agentic work should have a clear input, review gate, and output.

    Read next: ChatGPT Work vs Codex vs Claude Code, Codex vs Claude Code, and the AI Chief of Staff template.

    July 2026 FAQ

    Is Codex CLI the same as Codex in ChatGPT?

    No. The CLI is the terminal-first interface. Codex in the ChatGPT desktop app is the visual desktop mode for local folders, repositories, terminals, and developer tools. They belong to the same Codex direction, but they are different surfaces.

    Can Codex work with multiple repositories?

    Yes, but keep each task scoped. Use separate folders, worktrees, or branches so Codex can reason about one change at a time and so review stays clean.

    Does Codex usage count against ChatGPT Work usage?

    Where the features are available on your plan, OpenAI says Codex and ChatGPT Work can draw from the same agentic usage or credit pool. Check the current Help Center page for your plan before designing heavy daily workflows.

    Last updated: June 23, 2026

    Codex CLI is the fastest way to bring OpenAI's coding agent into a local repository. It lives in your terminal, reads the current project, edits files, runs commands, and keeps a transcript you can resume later.

    The search query "codex cli" is broad, but the intent is usually practical:

    • How do I install and start it?
    • Which model should I use?
    • Can it run tests and change files?
    • Does it support MCP?
    • When should I use CLI instead of the Codex app?

    This guide answers those questions without treating the CLI as a chatbot in a terminal. The CLI is better understood as a local agent runner for code, tests, reviews, and repeatable developer workflows.

    Quick answer

    Use Codex CLI when your work already lives in Git, shell commands, test suites, and repo-local instructions. Use the Codex app when you want desktop worktrees, built-in Git controls, visual review, automations, browser testing, or non-code artifacts in the same interface.

    NeedUse Codex CLIUse Codex app
    Edit a local repo from terminalYesYes
    Pipe prompts from scriptsYesNo
    Run quick code review from command lineYesYes
    Manage worktrees visuallyNoYes
    Preview browser or artifact outputLimitedYes
    Run repeatable project automationsYes with scriptsYes with app automations
    Work in CI or server scriptsYesNo

    What Codex CLI does

    Codex CLI starts an interactive terminal UI with access to the selected directory. From there, it can inspect files, propose edits, apply patches, run tests, and explain what changed. You can start a blank session with:

    codex
    

    Or pass the first task directly:

    codex "Explain this repository and list the risky parts"
    

    The official docs also describe codex exec for non-interactive runs. That matters for scripts, release checks, editorial gates, and recurring maintenance work.

    Recommended model

    OpenAI's Codex docs currently recommend gpt-5.5 for most Codex tasks. Use it when the work requires planning, multi-file edits, test interpretation, or long tool loops.

    You can specify it at launch:

    codex
    

    For lighter work, the available model list depends on your plan or API key. The important habit is to match model strength to blast radius. Small copy edits and one-file fixes do not need the same budget as a migration, security review, or production incident.

    MCP support

    Codex CLI supports Model Context Protocol servers through the Codex config and codex mcp commands. This is where the CLI becomes more than a code editor. MCP lets Codex use approved tools for databases, docs, browser flows, analytics, and internal systems.

    Good MCP use has three rules:

    1. Give Codex the smallest useful tool set.
    2. Keep secrets in the MCP server or environment, not in prompts.
    3. Write repo instructions that explain when each tool matters.

    MCP is especially useful for tasks like "read the failing Sentry issue, inspect the related code, patch it, run tests, and draft the PR summary."

    Daily workflow

    A practical Codex CLI day looks like this:

    1. Pull the latest main branch.
    2. Start Codex in the target repo.
    3. Ask for a short plan.
    4. Let it inspect the exact files.
    5. Approve scoped edits.
    6. Run tests from the same terminal.
    7. Ask Codex to review the diff before commit.

    For quick checks, use the review flow:

    codex
    /review
    

    For automation, use codex exec:

    codex exec "Update docs for the changed files and report any missing tests"
    

    Codex CLI vs ChatGPT

    ChatGPT is better when the work is broad thinking, writing, research, or file analysis without a repository. Codex CLI is better when the answer needs to become a code diff, a passing test, or a concrete change inside a local project.

    TaskBetter surface
    Explain a product ideaChatGPT
    Fix a failing testCodex CLI
    Draft a strategy memoChatGPT
    Refactor a moduleCodex CLI
    Compare toolsChatGPT or Codex app
    Run a scripted repo checkCodex CLI

    Codex CLI vs Claude Code

    Codex CLI and Claude Code both read code, edit files, run commands, and fit terminal-first workflows. The choice usually comes down to your surrounding stack.

    Choose Codex CLI if you want OpenAI models, Codex app sync, codex exec, built-in Codex review flows, and a path into Codex cloud or app worktrees. Choose Claude Code if your team already standardizes on Claude, CLAUDE.md, Claude Code hooks, or Anthropic's Claude Code ecosystem.

    I wrote the direct comparison here: Codex vs Claude Code.

    Common mistakes

    The biggest mistake is treating Codex CLI like a prompt box. It works better when the repository tells it how to behave.

    Add project instructions. Keep test commands obvious. Document dangerous paths. Name your verification steps. If a human would need five minutes to learn the repo's conventions, the agent needs that context too.

    The second mistake is asking for a huge change without checkpoints. Codex can handle large tasks, but you will get better results by splitting work into inspect, plan, edit, test, review, and commit.

    FAQ

    Is Codex CLI free?

    Codex availability and limits depend on your ChatGPT plan or API key. Check the current OpenAI Codex pricing and auth docs before planning team rollout.

    Does Codex CLI run locally?

    The CLI runs in your local terminal against the selected project directory. Model calls still go to OpenAI unless you configure a supported alternative through the product's documented paths.

    Can Codex CLI use MCP?

    Yes. Codex supports MCP servers through its configuration and MCP commands. Use MCP for approved external tools, docs, databases, and internal systems.

    Is Codex CLI better than the Codex app?

    It is better for terminal automation, scripting, and CI-shaped work. The app is better for visual multitasking, worktrees, Git controls, automations, browser testing, and artifacts.

    What should I read next?

    Read the broader ChatGPT vs Codex vs Claude Code vs Claude Cowork vs Gemini vs Antigravity comparison if you are choosing a work surface, not just a terminal tool.