OpenAI Codex CLI can be installed globally using npm or Homebrew (macOS/Linux), or by downloading the precompiled binary from GitHub.

Installation Methods:

  • npm (Cross-platform): Run npm install -g @openai/codex in your terminal. This is the recommended method for most users and works on macOS, Linux, and Windows.

  • Homebrew (macOS/Linux): Run brew install --cask codex to install the latest version directly.

  • Direct Binary: Download the appropriate binary (e.g., codex-x86_64-unknown-linux-musl) from the GitHub Releases page, rename it to codex, and add it to your system PATH.

Prerequisites and Setup:

  • Node.js: Ensure Node.js (v14 or later) is installed if using npm; Ubuntu users should install from NodeSource to avoid outdated versions.

  • Authentication: Run codex in your terminal to start; you will be prompted to sign in with a ChatGPT account (Plus, Pro, Business, Edu, or Enterprise) or an API key.

  • Windows Support: Native Windows support is currently experimental; for the best experience, use WSL (Windows Subsystem for Linux) and follow the standard Linux installation steps.

Verification and Updates:

  • Verify installation by running codex --version.

  • To upgrade to the latest version, execute npm upgrade @openai/codex@latest.

🌐
Openai
developers.openai.com › codex › cli
CLI – Codex | OpenAI Developers
It’s open source and built in Rust for speed and efficiency. ChatGPT Plus, Pro, Business, Edu, and Enterprise plans include Codex. Learn more about what’s included. ... Install the Codex CLI with npm.
🌐
GitHub
github.com › openai › codex
GitHub - openai/codex: Lightweight coding agent that runs in your terminal · GitHub
5 days ago - npm i -g @openai/codex or brew install --cask codex · Codex CLI is a coding agent from OpenAI that runs locally on your computer.
Starred by 69.9K users
Forked by 9.6K users
Languages   Rust 94.7% | Python 3.0% | TypeScript 1.4% | JavaScript 0.3% | Starlark 0.2% | Jupyter Notebook 0.1%
Discussions

How do you use OpenAI's Codex CLI?
Codex is the only way I’ve gotten agentic o4-mini to work well. You run codex in your IDE terminal. It’s more of a black box but it works. Think about it as Roo code / Cline / Cursor in the terminal without a good GUI. That’s what it is. More on reddit.com
🌐 r/OpenAI
5
7
April 17, 2025
Everything I Wish Existed When I Started Using Codex CLI — So I Built It
Hello u/shanraisshan 👋 Welcome to r/ChatGPTPro ! This is a community for advanced ChatGPT, AI tools, and prompt engineering discussions. Other members will now vote on whether your post fits our community guidelines. For other users, does this post fit the subreddit? If so, upvote this comment! Otherwise, downvote this comment! And if it does break the rules, downvote this comment and report this post! More on reddit.com
🌐 r/ChatGPTPro
1
23
1 month ago
Everything I Wish Existed When I Started Using Codex CLI — So I Built It
Hey u/shanraisshan , If your post is a screenshot of a ChatGPT conversation, please reply to this message with the conversation link or prompt. If your post is a DALL-E 3 image post, please reply with the prompt used to make this image. Consider joining our public discord server ! We have free bots with GPT-4 (with vision), image generators, and more! 🤖 Note: For any ChatGPT-related concerns, email support@openai.com - this subreddit is not part of OpenAI and is not a support channel. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/ChatGPT
3
0
1 month ago
Open source, community driven memory plugin for Codex CLI & Openclaw
https://github.com/Signet-AI/signetai More on reddit.com
🌐 r/OpenAI
9
11
2 days ago
🌐
Openai
developers.openai.com › codex › quickstart
Quickstart – Codex | OpenAI Developers
February 3, 2026 - Once you downloaded and installed the Codex app, open it and sign in with your ChatGPT account or an OpenAI API key. If you sign in with an OpenAI API key, some functionality such as cloud threads might not be available.
🌐
Milvus
milvus.io › ai-quick-reference › how-do-i-install-codex-cli-on-my-machine
How do I install Codex CLI on my machine?
Installing Codex CLI is straightforward ... Homebrew for macOS and Linux users, which you can execute with the simple command brew install codex....
🌐
amanhimself.dev
amanhimself.dev › blog › first-few-days-with-codex-cli
First few days with Codex CLI | amanhimself.dev
January 4, 2026 - The way I choose to install Codex CLI is by using global npm packages inside a terminal window. Before you do that, you should install Node.js on your machine. There are other ways you can opt to install Codex CLI and you can view them from ...
🌐
iTechs Online
itecsonline.com › post › how-to-codex-cli-linux
How To Install OpenAI Codex CLI on Ubuntu Linux: 2026 Guide
February 13, 2026 - Node.js 18+ for npm installation method (or download binary directly from GitHub Releases for zero-dependency install) Git 2.23+ (recommended for repository-aware operations) Stable internet connection to api.openai.com for all AI inference · A ChatGPT subscription — Plus ($20/mo), Pro ($200/mo), Business, Edu, or Enterprise · 2GB+ RAM minimum, 4GB recommended — Codex CLI itself is lightweight since inference runs in the cloud
🌐
Openai
developers.openai.com › codex › app
App – Codex | OpenAI Developers
February 12, 2026 - Once you downloaded and installed the Codex app, open it and sign in with your ChatGPT account or an OpenAI API key. If you sign in with an OpenAI API key, some functionality such as cloud threads might not be available.
🌐
npm
npmjs.com › package › @openai › codex
@openai/codex - npm
5 days ago - npm i -g @openai/codex or brew install --cask codex Codex CLI is a coding agent from OpenAI that runs locally on your computer.
      » npm install @openai/codex
    
Published   Mar 31, 2026
Version   0.118.0
Find elsewhere
🌐
DataCamp
datacamp.com › tutorial › open-ai-codex-cli-tutorial
OpenAI Codex CLI Tutorial | DataCamp
April 22, 2025 - Install Git: If you don’t already have Git installed, download and install it from git-scm.com. Set up Powershell: If you are using Windows, configure your powershell terminal as follows: ... Set Your OpenAI API Key: To use Codex CLI, you need an OpenAI API key.
🌐
CometAPI
cometapi.com › how-to-install-openais-codex-cli-locally
How to Install OpenAI’s Codex CLI Locally? A Simple Guide - CometAPI - All AI Models in One API
June 9, 2025 - Since its announcement on April 16, 2025, and subsequent updates—including internet-access capabilities on June 3, 2025—the Codex CLI offers a secure, privacy-focused, and highly customizable way to harness OpenAI’s powerful reasoning models right from your terminal. This article synthesizes the latest developments and provides a step-by-step guide to installing and configuring the Codex CLI on your machine.
🌐
Reddit
reddit.com › r/openai › how do you use openai's codex cli?
r/OpenAI on Reddit: How do you use OpenAI's Codex CLI?
April 17, 2025 -

Hi,

OpenAI released their Codex CLI. It brings an AI coding agent directly to your terminal.

Do you find it useful for shell-based tasks? What do you use it for?

Automating file edits or refactoring code snippets ?? Isn't it better to integrate an LLM with an IDE? Cursor, VS Code, Github Copilot etc etc.

I suppose it's useful if you automate tasks in your terminal. But it's only something I do occasionally, when I train models on cloud computers, I commit/pull code back and forth between my computer and the cloud instance via Github. Can you give me your use cases?

Thanks.

Top answer
1 of 4
3
Codex is the only way I’ve gotten agentic o4-mini to work well. You run codex in your IDE terminal. It’s more of a black box but it works. Think about it as Roo code / Cline / Cursor in the terminal without a good GUI. That’s what it is.
2 of 4
2
I have access to 11m tokens a day and have been having fun with it... there are some issues regarding Windows and Sandboxing as it tried to limit the damage it may do. I install it with node, npm install -g @ openai/codex - no space, unsure how to format it with it on reddit. Then from there I just make sure I have my environment variable set for OPENAI_API_KEY ... if you have WSL on Windows enabled you can just use that too and do the same thing, just make sure node v22 or higher is installed. So far I have not had great success with it being an overall AMAZING change... I ask it to do a high level task, it sandboxes, it breaks... I am looking to fix this with some changes to maybe running it via Docker, but eh... no time. That said, it does do a great job with getting files changed, reviewing file structure, and it did help me make a theoretical TWAIN Driver Redirector application similar to TS-Scan or RemoteScan ... but I have not actually tested the output... - It produced an exe though, it ran through and made every file for me and then it was able to also review bugs and continually run... this took about 2.5 million tokens. I then wanted to make a web game with basic multiplayer capabilities and it sort of failed at this... Claude 3.7 on the other hand was able to run 4200 lines in a single artifact and it worked. The end result of the web game attempt was 780 seconds of run time and 8.3 million tokens used. I am part of a "share your data with us and we will give you tokens" program... I have no idea how I got it but I am testing things out as I go and attempting to make some tests.. overall I just don't have any projects really to throw at it at the moment... anything I have attempted so far has been bested by Claude truthfully....
🌐
Medium
reading.sh › the-definitive-guide-to-codex-cli-from-first-install-to-production-workflows-a9f1e7c887ab
The definitive guide to Codex CLI: from first install to production workflows | Reading.sh
February 23, 2026 - Parts 1 through 3 cover the basics: what Codex is, how to install it, and how to configure it. Parts 4 through 6 cover the instruction and safety systems: AGENTS.md, approval modes, and steer mode. Parts 7 and 8 cover extensibility: MCP servers and skills. Parts 9 through 11 cover advanced usage, models, and how Codex compares to the competition. Skip to whatever you need. Come back for the rest later. Codex CLI is a terminal-native coding agent from OpenAI.
🌐
GitHub
github.com › microsoft › Codex-CLI › blob › main › Installation.md
Codex-CLI/Installation.md at main · microsoft/Codex-CLI
To install the required python packages, please go to the command line in the shell of your choice and enter the following commands: ... Additionally, the OpenAI API key, organization id, and engine id are required to execute the Codex CLI tool.
Author   microsoft
🌐
Apidog
apidog.com › blog › how-to-install-and-use-codex-cli-the-claude-code
How to Install and Use Codex CLI: OpenAI's Response to Claude Code
January 29, 2026 - What Is the OpenAI Codex CLI?PrerequisitesStep 1 — Install Codex CLIStep 2 — Authenticate Codex CLIStep 3 — Launch and Use Codex CLISlash Commands You Should KnowStep 4 — Codex CLI Approval Modes and SafetyPractical Debugging Examples in CodexNon-Interactive Usage: codex execAdvanced Codex Configuration and FeaturesCodex CLI in IDEsPairing Codex with Apidog for API-Centric ProjectsFrequently Asked QuestionsConclusion
🌐
Openai
developers.openai.com › codex › cli › reference
Command line options – Codex CLI | OpenAI Developers
codex app installs/opens the desktop app on macOS, then opens the provided workspace path. This subcommand is macOS-only. Send one message through app-server’s V2 thread/turn flow using the built-in app-server test client.
🌐
Analytics Vidhya
analyticsvidhya.com › home › how to install and use openai’s codex cli locally?
How to Install and Use OpenAI's Codex CLI Locally?
May 29, 2025 - Use the command: npm install -g @openai/codex – this command will install codex cli globally in your system.
🌐
Harvard
zitniklab.hms.harvard.edu › tooluniverse › set up tooluniverse › codex cli
Codex CLI - ToolUniverse Documentation
Codex CLI · Install: npm install -g @openai/codex · Official MCP setup guide · To set up ToolUniverse, open Codex CLI and run: Read https://aiscientist.tools/setup.md and set up ToolUniverse for me. Back to top · Previous · Qwen Code ·