how to build

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

1. Install it

Mac

  1. Paste this into your terminal and press Enter.
    curl -fsSL https://chatgpt.com/codex/install.sh | sh

    You 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:

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

    You 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

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

    You should see: a download, then the prompt comes back.

Or, with Node from chapter 1: npm install -g @openai/codex.

  1. Close the terminal and open a new one.
  2. Check the install:
    codex --version

    You should see: codex-cli followed by a version number, like codex-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.

  1. Go to a project folder. The Hello folder from chapter 2 is fine. If you skipped it, make one.
    mkdir -p ~/code/hello
    cd ~/code/hello
  2. Start Codex.
    codex

    You should see: a choice of how to sign in.

  3. 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.

  1. 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.

  2. Write the memory file:
    /init

    You should see: it writes a file called AGENTS.md. Codex reads this at the start of every session. It does the same job as CLAUDE.md does for Claude Code.

  3. Ask it a question:
    What does this project do?

    You should see: a short answer about your page.

  4. 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

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

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:

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.