How to Install Codex CLI, OpenAI's Terminal Coding Assistant
OpenAI's lightweight AI coding assistant that runs in your terminal: ask in plain language and it writes and edits code, runs commands and handles programming tasks.
What is Codex CLI?
Codex CLI is OpenAI's lightweight AI coding assistant that runs in your terminal. It is published on GitHub as openai/codex. You type requests in plain language and it writes and edits code, runs commands and handles programming tasks without leaving the terminal. It is small, fast and made by OpenAI, which makes it a natural fit if you already use ChatGPT or the OpenAI API.
It works in your terminal, and it can also run inside editors such as VS Code, Cursor and Windsurf, or as a desktop app.
What can you do with it?
- Ask AI to write and edit code in your terminal
- Let it handle routine programming tasks on its own
- Use it in your editor or as a desktop app as well
- Work with a lightweight tool that starts fast and stays out of the way
How to install Codex CLI
On macOS or Linux, the fastest way is the official install script. Open a terminal and run:
curl -fsSL https://chatgpt.com/codex/install.sh | shOn Windows, run this in PowerShell:
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"You can also install it with a package manager. With npm:
npm install -g @openai/codexWith Homebrew on macOS:
brew install --cask codexThen start it by running:
codexThere is also a cloud-based agent called Codex Web at chatgpt.com/codex, which is a different product from the CLI.
First steps after installing
Open a terminal, move into a project folder and run codex. Start with a small, safe request, such as asking it to explain the project structure or to find where a function is defined. Review the changes it proposes before accepting them. Once you trust it, give it a routine task such as fixing a failing test, and let it run the commands and report back.
Frequently asked questions
Is Codex CLI free? The tool itself is free to download and install. Note that using it needs a ChatGPT or OpenAI account, and usage may be billed depending on your plan.
Is it hard to install? No. One command installs it on any platform.
Can I use it in my editor? Yes. It works in VS Code, Cursor and Windsurf as well as in the terminal.
Comments (0)