Guide · 3 of 8
Get Codex
Codex is OpenAI's agent for the terminal. It does the same kind of job as Claude Code: you say what you want, it reads and writes your files and runs commands. If you pay for ChatGPT, you may already have it. By the end of this page it will be installed, signed in, and you will know if you want it, Claude Code, or both.
You need
- A terminal, git and a
~/codefolder from Set up your computer. - A ChatGPT account. Which plans include Codex is in step 2.
- You do not need Claude Code for this page. If you skipped Get Claude Code, that is fine.
1. Install it
Mac
- Paste this into your terminal and press Enter.
curl -fsSL https://chatgpt.com/codex/install.sh | shYou should see: a download, then the prompt comes back. Read the last few lines in case it asks you to do anything.
Two other ways work too. With Node from chapter 1: npm install -g @openai/codex. With Homebrew: brew install --cask codex.
Windows
On Windows, install Codex inside WSL. Open Ubuntu and run the same command as Linux:
-
curl -fsSL https://chatgpt.com/codex/install.sh | shYou should see: a download, then the prompt comes back.
If you set up Node in WSL in chapter 1, npm install -g @openai/codex works too.
Not using WSL? Use the Codex desktop app or the IDE extension (see "Other ways in" below) instead of the terminal version.
Linux
-
curl -fsSL https://chatgpt.com/codex/install.sh | shYou should see: a download, then the prompt comes back.
Or, with Node from chapter 1: npm install -g @openai/codex.
- Close the terminal and open a new one.
- Check the install:
codex --versionYou should see:
codex-clifollowed by a version number, likecodex-cli 0.166.0. Your number will be different.
2. Pick a plan and sign in
Codex comes with ChatGPT plans. It is included in Plus, Pro, Business, Edu and Enterprise. The Free and Go plans get a small allowance at most. Sources disagree on how much, and it changes, so check chatgpt.com/pricing before you count on it.
If you are starting out and have no plan, Plus is the entry plan. No card of your own? Same advice as for Claude: ask a parent or guardian, and read the sign-up terms together.
- Go to a project folder. The Hello folder from chapter 2 is fine. If you skipped it, make one.
mkdir -p ~/code/hellocd ~/code/hello - Start Codex.
codexYou should see: a choice of how to sign in.
- Choose "Sign in with ChatGPT". Your browser opens. Log in with your ChatGPT account and approve. Then go back to the terminal.
You should see: a box where you can type.
3. Your first session
Like Claude Code, commands that start with a slash are for Codex itself. Anything else is a message to the agent.
- If the folder is empty, ask for something small first:
Make an index.html that says Hello and shows today's date. Keep it to one file.You should see: Codex says what it will do and makes the file, asking first if it needs to. Open it in your browser the same way as in chapter 2.
- Write the memory file:
/initYou should see: it writes a file called
AGENTS.md. Codex reads this at the start of every session. It does the same job asCLAUDE.mddoes for Claude Code. - Ask it a question:
What does this project do?You should see: a short answer about your page.
- Make a tiny change:
Add a button that changes the background to a random colour.You should see: it changes
index.html. Reload the page in the browser and click the button.
Commands worth knowing
/statusshows your account and how much allowance you have left./permissionssets when Codex may edit files or run commands without asking you. Keep it asking until you know what it is doing./modelpicks the model, and how hard it thinks (called reasoning effort). Harder thinking is slower and uses more of your allowance./reviewasks Codex to look over the changes made so far and point out problems. Worth running before you call something done.
From here on, hand it the commands
You now have a program that knows the terminal, git, GitHub and Cloudflare far better than most people. The rest of this guide still shows the commands, folded away under "By hand", for when you are curious. You do not have to learn them. Say what you want in plain words, read what it asks to run, say yes. After a few projects you will know the commands anyway, just from watching.
4. Limits
Codex limits have the same shape as Claude's. Your use is counted over a rolling 5-hour window, and there is a weekly cap too. Since April 2026 it is measured in credits. When you run out, it stops until the limit resets. Your files are safe while you wait.
Check where you are with /status, or at chatgpt.com/codex. The same habits help: start fresh for each new task, and keep conversations short. And pick the model to fit the job. Astra for plans and hard bugs, GPT-6.1 Sol for the everyday work. See Which model, and when.
Other ways in
- Codex cloud runs tasks on OpenAI's computers instead of yours. Start them with
codex cloudor at chatgpt.com/codex. - IDE extension puts Codex inside your editor, VS Code included.
- Desktop app if you prefer windows to a terminal.
Claude Code or Codex?
Both are good. Both read your project, write code, run commands and ask before doing anything risky. Plenty of people use both, and some have one review the other's work. This site treats them as the same kind of tool. Every step from here on works with either one.
The differences that matter when you are starting:
- Which plan you already pay for. If you have ChatGPT Plus, start with Codex. If you have Claude Pro, start with Claude Code. Do not buy a second plan until you hit the limits of the first.
- The memory file name. Claude Code reads
CLAUDE.md. Codex readsAGENTS.md. They do the same job. If you use both on one project, keep the same rules in both files, the way this site's own repo does.
Try one for a week. If it suits you, keep going. If it annoys you, try the other.
If it didn't
What you just did
You installed Codex and signed in with ChatGPT. You had it write AGENTS.md with /init, asked it a question and changed a page. You know where to check your allowance, and how Codex and Claude Code compare.