Installer OpenAI Codex CLI : connexion et première tâche dans un dépôt Git

Installation officielle, connexion ChatGPT/API, un diff relisible dans le dépôt Git.

The first hour with OpenAI Codex CLI usually breaks on the installer, PATH, or picking ChatGPT sign-in versus API-key billing. Install from OpenAI’s docs, authenticate, then land one reviewable change in a Git repo you own.

La requête est installer et utiliser OpenAI Codex CLI. This page follows developers.openai.com/codex/cli and the ChatGPT Learn CLI guide at learn.chatgpt.com/docs/codex/cli. It is the local terminal agent—not chatgpt.com/codex in the browser, and not the IDE extension. To walk a diff on a short call, open a room on wbmeet; see how to create and join a room.

Install codexSign inOne repo task

Confirm you want the CLI product

OpenAI ships several Codex surfaces: terminal Codex CLI (this page), editor extensions, desktop codex app, and cloud Codex at chatgpt.com/codex. Here you run codex inside a project folder; it reads files, proposes or applies edits, and may run shell commands depending on approval settings.

CLI
Local terminal agent
npm
or install.sh
1×
Browser sign-in

First hour: install, sign in, change something reviewable

  1. 1

    Install from an official channel

    macOS / Linux script: curl -fsSL https://chatgpt.com/codex/install.sh | sh. All platforms: npm install -g @openai/codex (requires Node.js). On Windows or locked-down machines, download the platform binary from OpenAI’s Codex GitHub releases—details on developers.openai.com/codex/cli. Open a new terminal, then codex --version or which codex.

  2. 2

    Start in the repo and sign in

    cd into a Git repo you own and run codex. On first launch choose Sign in with ChatGPT (Plus, Pro, Business, Edu, or Enterprise—per OpenAI’s current plan docs). For API billing, create a key on the OpenAI Platform, export OPENAI_API_KEY, then start Codex. Never commit keys or paste .env into prompts.

  3. 3

    Pick a conservative permission mode

    Codex will ask what it may read or execute. On the first run, prefer approvals before shell commands and read diffs before apply. Confirm org policy before sending repository context to OpenAI.

  4. 4

    Give a reviewable first coding task

    Ask what the project does and where the entry point lives. Then: “Add a unit test for one untested helper, or input validation on one public function. Show the diff and wait before writing.” Run your tests and git diff yourself before committing.

# First hour · OpenAI Codex CLI · 2026-10
curl -fsSL https://chatgpt.com/codex/install.sh | sh
# or: npm install -g @openai/codex
codex --version
cd /path/to/your/git/repo
codex
# Sign in with ChatGPT
# first task: unit test for one helper; show diff first

Sign-in paths, install channels, pitfalls

PathWhat OpenAI documentsFirst-hour note
Sign in with ChatGPTPlus / Pro / Business plansRecommended for individuals
OPENAI_API_KEYPlatform API billingDo not commit the key
install.shmacOS / LinuxNew terminal before codex
npm @openai/codexCross-platformCheck Node and PATH
chatgpt.com/codexCloud Codex WebNot this CLI
01

command not found after install

Usually PATH. Close the old window, open a new terminal. For npm globals, ensure your global bin directory is on PATH.

02

Running beside Copilot or Claude Code

Multiple terminal agents can coexist—just avoid two agents editing the same tree at once. Compare Copilot CLI and Claude Code.

03

First task stayed chat-only

Warm up with “what does this repo do,” then finish with a test, validation, or a bug you name—and read the diff.

OpenAI’s flow: run codex in a project directory, sign in, then complete one real coding task. Plans, regions, and limits follow developers.openai.com and your ChatGPT account page.

CLI ≠ IDE Codex
Editor integration is a separate install path; this page covers the codex terminal binary only.
CLI ≠ Codex Web
Cloud agent lives at chatgpt.com/codex; the CLI works locally in your checkout.
Not a meeting-product guide
Only Codex CLI’s first hour. Short huddle: wbmeet or Cursor CLI notes.

Questions worth checking

Can I use Codex CLI without a paid ChatGPT plan?

OpenAI documents ChatGPT sign-in and a separate API-key path with Platform billing. Whether a free ChatGPT tier includes Codex follows the current plan page—use official signup only.

npm or install.sh?

Both install the codex command. Prefer npm if Node is already set up; macOS/Linux can use install.sh to skip extra tooling.

ChatGPT login vs API key?

ChatGPT sign-in uses subscription entitlements; API keys bill through the OpenAI Platform. Enterprises often standardize on API keys plus org policy.

Must the first task auto-commit Git?

No. Review the diff, run tests, then commit yourself when satisfied.

Démarrer une réunion gratuite