October 23, 2026

Codex CLI のインストールとセットアップ方法

Codex CLI は、OpenAI が提供するターミナル向けのオープンソースのコーディングエージェントです。このガイドでは、macOS、Linux、Windows に Codex CLI をインストールするすべての方法と、ログイン方法、最初のセッション、設定、アップデート方法を解説します。そのうえで、Chief で Codex を Claude Code と併用する方法を紹介します。

クイックインストール

プラットフォームコマンド
macOS と Linuxcurl -fsSL https://chatgpt.com/codex/install.sh | sh
Windows(PowerShell)powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
npm(全プラットフォーム)npm install -g @openai/codex
Homebrewbrew install --cask codex

その後、プロジェクトフォルダで codex を実行し、ChatGPT でログインを選択します。

コマンドは OpenAI の Codex README とドキュメントに基づき、2026 年 10 月に確認したものです。最新情報は OpenAI の Codex ドキュメントを確認してください。


ステップ 1:Codex CLI をインストールする

macOS と Linux

macOS と Linux では、OpenAI のスタンドアロンインストーラーで Codex CLI をインストールする方法が推奨されています:

curl -fsSL https://chatgpt.com/codex/install.sh | sh

Codex CLI は、Apple Silicon と Intel の macOS、x86_64 と arm64 の Linux に対応しています。

パッケージマネージャーを使いたい場合は、Homebrew を使います:

brew install --cask codex

または npm を使います:

npm install -g @openai/codex

Codex の GitHub リリースページからお使いのプラットフォーム向けのバイナリをダウンロードし、名前を codex に変更することもできます。

Windows

Codex CLI は Windows 上でネイティブに動作します。Windows に Codex CLI をインストールするには、PowerShell で次のコマンドを実行します:

powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

Windows では、Codex はデフォルトで Windows ネイティブのサンドボックスを使用するため、WSL や仮想マシンは不要です。Linux ネイティブのツールが必要な場合や、ワークフローがすでに WSL2 上で動いている場合については、OpenAI は WSL2 の利用を提案しています。その場合は、上記の macOS と Linux 向けのコマンドで WSL 内に Codex をインストールしてください。

インストールを確認する

codex --version

問題がありそうな場合は、codex doctor でインストール、設定、ログイン、ランタイムの状態を確認できます。

ステップ 2:ログインする

任意のフォルダで codex を実行します。初回はログイン方法の選択を求められます:

  • ChatGPT でログインは ChatGPT のプランを使用するため、Codex の利用はサブスクリプションに含まれます。Plus、Pro、Business、Edu、Enterprise プランではこの方法が推奨されています。
  • API キーでログインは、利用料金を OpenAI API アカウントに請求します。

コマンドラインからログインすることもできます:

codex login                                            # browser sign-in
printenv OPENAI_API_KEY | codex login --with-api-key   # API key from stdin
codex login --device-auth                              # device code, for remote or headless machines
codex login status                                     # show the active sign-in
codex logout                                           # clear stored credentials

サーバーやブラウザのないマシンでは、OpenAI はデバイスコードによるログインを推奨しています。Codex は認証情報を ~/.codex/auth.json または OS の認証情報ストアに保存します。

ステップ 3:最初のセッションを実行する

プロジェクトを開いて Codex を起動します:

cd my-project
codex

「新規登録フォームに入力バリデーションとそのテストを追加して」のように、タスクを普段の言葉で入力します。初日から知っておきたいスラッシュコマンドをいくつか紹介します:

コマンド機能
/initCodex への指示を記載した AGENTS.md ファイルを作成します
/modelモデルと推論の強度を選択します
/permissionsCodex が確認なしで実行できる操作を選択します
/status現在のセッションの設定を表示します
/review変更をレビューし、問題を見つけます

AGENTS.md には、テストの実行方法、従うべき規約、避けるべきことなど、プロジェクトの仕組みを Codex に伝える内容を書きます。/init を一度実行し、生成された内容を編集してください。

ステップ 4:権限とデフォルト設定を行う

Codex は、設定した範囲を超えてファイルを編集したりコマンドを実行したりする前に確認を求めます。この動作は、/permissions でセッションごとに変更するか、フラグを付けて Codex を起動することで変更できます:

codex --sandbox workspace-write --ask-for-approval on-request

サンドボックスモードには read-only、workspace-write、danger-full-access があります。永続的なデフォルトにするには、同じオプションを ~/.codex/config.toml に設定します:

model = "gpt-6.1-sol"
approval_policy = "on-request"
sandbox_mode = "workspace-write"

codex --profile <name> を使うと、名前付きプロファイルをベース設定の上に重ねて適用できます。たとえば、慎重な作業用と手早い実験用でプロファイルを分けられます。

ステップ 5:Codex CLI をアップデートする

Codex は頻繁にアップデートされます。最も簡単なアップデート方法は次のとおりです:

codex update

または、インストールに使ったツールでアップデートします:

curl -fsSL https://chatgpt.com/codex/install.sh | sh   # standalone installer: rerun it
npm install -g @openai/codex@latest                    # npm
brew upgrade --cask codex                              # Homebrew

その後 codex --version を実行し、新しいバージョンになったことを確認します。

便利な Codex CLI コマンド

コマンド機能
codex対話型セッションを開始します
codex exec "<task>"スクリプトや CI 向けに、タスクを非対話で実行します
codex reviewコードレビューを非対話で実行します
codex resume以前のセッションを再開します(最新のセッションは --last)
codex --worktree新しい git worktree でセッションを実行します
codex mcpMCP サーバーを管理します
codex appCodex デスクトップアプリを起動します

Chief で Codex と Claude Code を併用する

Codex CLI のインストールとログインが済めば、Chief で使う準備は完了です。Chief は AI エージェントマネージャーです。目標を設定すると、Chief がそれをマイルストーンとして計画し、各マイルストーンを選んだエージェントで実行します。

  • Codex と Claude Code を 1 つの計画で使えます。 プロジェクトごとにデフォルトのエージェントを設定し、マイルストーンごとに Codex か Claude Code を選べます。それぞれが力を発揮する場面は Claude Code と Codex の比較をご覧ください。
  • インストールしたばかりの Codex を実行します。 Chief のリレーは macOS、Linux、Windows で動作し、あなた自身の ChatGPT アカウントでログインした、お使いのマシン上の codex を起動します。コードは今ある場所から動きません。
  • 独立した作業は並列で実行します。 Chief は、依存関係が完了したマイルストーンをすべて同時に実行し、各結果をそれぞれの完了の定義に照らして確認します。
  • Codex から Chief と対話できます。 codex mcp で Chief の MCP サーバーを追加すれば、セッションを離れることなく、あなたの対応待ちになっているものを確認できます。

Chief で Codex を実行しましょう。無料で始める →

組み合わせの詳細:Chief + Codex。


よくある質問

Codex CLI はどうやってインストールしますか?

macOS と Linux では curl -fsSL https://chatgpt.com/codex/install.sh | sh を実行します。Windows では PowerShell インストーラーを実行します。npm install -g @openai/codex や brew install --cask codex も使えます。その後、codex を実行してログインします。

Codex CLI は Windows で動作しますか?

はい。Codex CLI は Windows サンドボックスを使って Windows 上でネイティブに動作するため、WSL は必要ありません。ツールが Linux ネイティブの場合は、引き続き WSL2 を使うこともできます。

Codex CLI はどうやってアップデートしますか?

codex update を実行するか、インストールに使ったツールでアップデートします。インストールスクリプトを再実行するか、npm install -g @openai/codex@latest または brew upgrade --cask codex を実行してください。

Codex CLI は無料ですか?

Codex CLI は Apache-2.0 ライセンスのオープンソースです。利用するには、Codex を含む ChatGPT プランか、トークン単位で課金される OpenAI API キーが必要です。最新のプランは OpenAI の料金ページで確認してください。

Codex CLI のインストールに Node.js は必要ですか?

いいえ。スタンドアロンインストーラーと Homebrew では Node.js は不要です。Node.js が必要になるのは、npm でインストールする場合だけです。

Codex CLI と Claude Code は併用できますか?

はい。同じファイルを編集しないよう、それぞれに専用のブランチや git worktree を割り当てるか、Chief に作業を計画させ、各マイルストーンを選んだエージェントに送らせることができます。

More articles

AI Agent Orchestration Guide

What AI agent orchestration is, how multi-agent orchestration works for Claude Code and Codex, and a comparison of orchestration approaches. Free guide.

What Is Agentic Engineering?

Agentic engineering means directing AI coding agents that write and test code while you set goals and review results. How it differs from agentic coding.

AI Code Review at Scale

What AI code review is, the main types of AI code review tools, and five workflows for reviewing AI-generated code from several coding agents at once.

Claude Code and Codex Pricing

Claude Code pricing from $20/mo (Pro) to $200/mo (Max 20x), Codex pricing from ChatGPT Free to Pro, usage limits and a comparison table, checked Oct 2026.

From Single Agent to Multi-Agent

Already using one AI coding agent? Here's how to scale to multiple instances running in parallel — the concurrency patterns, worktree isolation, and task decomposition strategies that make it work.

Vibe Coding at Scale

Vibe coding with one agent is fun. Vibe coding with five is chaos — unless you have orchestration. Here's how to scale the vibe without losing the quality.

Why AI Agents Need an Orchestration Layer

Running AI coding agents in terminal tabs works for two. Five signs you've outgrown it, tabs vs an orchestration layer, and what to look for in one.

Multi-Provider AI Orchestration

Claude Code, Codex, Cursor, Aider — each excels at different work. Here's how to combine providers into one coordinated workflow and why cross-provider review catches bugs single-provider setups miss.

Use Chief From Your AI Assistant

Add Chief's remote MCP server to Claude, Claude Code or Codex. Ask what's waiting on you, catch up on what shipped and propose milestones from chat.

Claude Code vs Codex: When to Use Each

Codex vs Claude Code: when each fits, a comparison table and FAQ. Claude Code vs Codex isn't either-or; Chief runs both on your projects.

Claude Code vs Cursor: When to Use Each

Cursor vs Claude Code: when each fits, a comparison table and FAQ. Claude Code vs Cursor isn't either-or; keep Cursor and let Chief run Claude Code.

How to Run Multiple Claude Code Agents in Parallel

Run multiple Claude Code agents in parallel, step by step: worktrees, background agents, subagents and review. Then let Chief orchestrate them for you.

Git Worktrees for AI Coding Agents

How to use git worktrees with Claude Code and Codex: one per agent, parallel runs, .env files, merging and cleanup. Every command, step by step.

How to Run Claude Code From Your Phone

Run Claude Code from your phone: Remote Control, cloud sessions in the Claude mobile app, or SSH and tmux, step by step. Plus approving agents in Discord.

The Best AI Coding Agents in 2026

The best AI coding agents of 2026: Claude Code, Codex, Cursor, Copilot and more agentic AI coding tools compared, and how to run several with Chief.

Subagents vs Parallel Agents

What is a subagent? How Claude Code subagents and Codex subagents work, how they differ from parallel agents, and when to use each one.

Ready to manage your agents?

_Codex は OpenAI の商標です。Claude Code は Anthropic の商標です。Chief は独立した製品であり、いずれの企業とも提携しておらず、後援や推奨も受けていません。_