Phone:+16179821253
Address: 315 W 3rd St, Boston, Massachusetts, 02127, USA
Email: sloanecarter773@gmail.com
Phone:+16179821253
Address: 315 W 3rd St, Boston, Massachusetts, 02127, USA
Email: sloanecarter773@gmail.com
This codex cli tutorial covers what Codex CLI does, how to install it, how to sign in, and how to run your first task from a project folder.By the end, you'll have a working session and a sense of what to try next.
Codex CLI is OpenAI's open source coding agent that runs inside your terminal. According to Wikipedia, it was released in April 2025 and was built for software engineering tasks like writing code and fixing bugs.
You describe a task in plain language, and it reads your files, proposes edits, and can run commands on your machine. Nothing leaves your local environment unless you tell it to.
In practice, most people reach for it the same way they'd reach for a very capable pair programmer who happens to live in a terminal window instead of a chat app.
That's really the whole idea behind this codex cli tutorial: getting you from a blank terminal to a working session without guesswork.
A few things need to be in place first.
Teams that skip the prerequisite check usually end up troubleshooting an install failure that had nothing to do with Codex itself. Confirming Node.js is present first saves that detour.
There are a few install paths, and which one you pick mostly comes down to what's already on your machine.
npm install –global @openai/codex
This is the most common route, since most developers already have Node.js set up.
As reported by TechCrunch, OpenAI described the original goal of Codex CLI as giving users a minimal, transparent interface for connecting AI models directly to local code and tasks, which is part of why the install process stays this simple.
brew install codex
A reasonable option if you already manage your command line tools through Homebrew.
curl -fsSL https://chatgpt.com/codex/install.sh | sh
Works on macOS and Linux without needing Node.js at all.
codex –version
You should see a version number printed back, something like codex-cli 0.77.0. The exact number will differ depending on when you install it, since Codex CLI updates fairly often. That's normal. What matters is that a version prints at all.
If nothing comes back, the install didn't complete, and it's worth rerunning the command before moving on.
Once it's installed, Codex needs to know who you are before it'll do anything useful.
Run codex for the first time, then choose "Sign in with ChatGPT" when prompted. This is the path most people take, and usage is included as part of your ChatGPT plan rather than billed separately.
For automation, scripts, or CI pipelines where a browser sign-in doesn't make sense, set an environment variable instead:
export OPENAI_API_KEY=your-api-key
This method skips the interactive login entirely, which is the point.
With installation and sign-in out of the way, this is where the tutorial actually gets useful.
Navigate to a project folder in your terminal, or on macOS, right-click the folder in Finder and choose "New Terminal at Folder." Either gets you to the same place.
codex
From here, describe what you want. Something simple works well as a first test, like asking it to explain the project structure.
A slightly more hands-on example might be asking it to add error handling to a specific file. Codex reads the relevant files first, then proposes a change rather than just guessing at one blindly.
Codex shows proposed edits in a diff view. You accept or reject each change individually rather than approving everything at once.
This step is where most of the actual trust building happens. Once you've watched it make a handful of sensible, small edits, running it with less oversight starts to feel less risky.
This is one part of the tutorial worth slowing down on, because the three modes genuinely change how much Codex can do without asking first.
|
Approval Mode |
What It Allows |
Best For |
|
Auto (default) |
Reads, edits, and runs commands inside your working directory. Asks first for anything outside that scope |
Everyday tasks where you want speed without giving up all oversight |
|
Read-only |
Consultative only. No file edits, no commands run |
Exploring or understanding a codebase before making changes |
|
Full Access |
Broader autonomy, including network access |
Users who've already built confidence in how Codex behaves |
Switch modes mid-session with /permissions. Some versions of Codex also respond to /approval, so if one doesn't work, try the other.
There's no universally correct mode here. Someone working solo on a side project might jump straight to full autonomy. A team touching production code will usually stay closer to the default, at least at first.
A handful of commands come up often enough that they're worth memorizing early.
Prefix any shell command with ! and it runs immediately, with the output staying visible in the conversation:
!ls
!pwd
!git status
This turns out to be a small but genuinely useful detail. Instead of switching to a separate terminal tab to check git status and then explaining what you saw, you just run it inline. Codex sees the same output you do.
Sessions don't just disappear when you close the terminal. Exit with Ctrl+C, and Codex shows a session ID. Reopen it with:
codex resume [session-id]
Or, for the most recent conversation specifically:
codex resume –last
Session logs are stored locally in a structured text format, which is part of why resuming works as cleanly as it does. Context from the earlier conversation carries forward instead of starting from zero.
An AGENTS.md file sits at the root of your project and gives Codex standing instructions it reads at the start of every session. Create one manually, or run /init to generate a starting template.
A basic version might describe your tech stack, your coding conventions, and any commands Codex should run before considering a task finished, like a test suite. Once it's in place, you stop repeating the same context in every session, which is really the entire point of having it.
MCP, short for Model Context Protocol, is an open standard that lets Codex talk to tools outside your local filesystem, things like browsers, project management tools, or documentation sites.
codex mcp add [server-name] [command]
Check what's connected at any point with:
codex mcp list
Alternatively, MCP servers can be defined directly inside the Codex configuration file, which some people prefer for anything they want to persist without re-adding it each time.
Teams experimenting with MCP for the first time commonly report that the setup step is straightforward, but knowing which server actually fits a given workflow takes a bit more trial and error.
Most early friction comes down to one of two things.
If Codex can't take an action inside your project directory, check that the current approval mode actually grants that access. Switching modes with /permissions usually resolves it.
If you're on Windows and running into odd behavior, that lines up with what's expected right now. Windows support is still labeled experimental, and running Codex inside WSL tends to sidestep most of the friction.
Codex CLI comes down to a repeatable pattern: install, sign in, run a task, review the diff. Once that loop feels familiar, approval modes, AGENTS.md, and MCP extend what it can handle without much extra effort.
Not on its own. It requires either a paid ChatGPT plan that includes Codex access, or an OpenAI API key, which is billed separately based on usage.
macOS and Linux have full support. Windows currently works but is labeled experimental, and running it through WSL tends to be more reliable.
Yes. Authenticating with an OpenAI API key instead of signing in works well for automation, scripts, or CI pipelines that don't involve a browser.
Run /model during an active session. Available models change periodically, so it's worth checking what's currently listed rather than assuming.
Auto allows edits and commands inside your working directory by default. Read-only permits no changes at all. Full Access extends autonomy further, including network access.
Transform complex datasets into clear, interactive visualizations with Violin Plot. Start exploring data distributions in a way that empowers insight and drives smarter decisions.



