Codex guides

FREE GUIDE

Codex CLI

Use Codex from your terminal to understand a local website and make one small, reviewable change.

  • 5 min read
  • Step by step
  • Copy-ready prompt

Use Codex from your terminal to understand a local website and make one small, reviewable change. You will install the command-line tool, start it in the correct folder, and check both its file edits and the website behavior.

Before you start

  • A terminal on macOS, Linux, or Windows and a local copy of a website project you can edit.
  • A supported Codex sign-in: ChatGPT access or API key access. API key usage is billed through the OpenAI Platform account rather than included ChatGPT plan usage.
  • A working npm installation for the installation route shown here. If you do not use npm, choose the operating-system installer in OpenAI’s current CLI documentation instead.
  • The website’s required runtime and dependencies, its setup instructions, and a saved copy or Git checkpoint of the current files.

Want to do it yourself?

Difficulty
6 out of 10
Estimated completion time
45–90 minutes

Skills you’ll need: Use a terminal, install the CLI, navigate to a project folder, and inspect and test the resulting file edits.

How this helps your brand

A focused terminal workflow can keep website maintenance tied to an exact request and existing checks. Reviewing the diff and the running page helps protect the links and behavior around a small edit.

  1. Step 1: Install the CLI using one supported method

    With npm available, enter npm install -g @openai/codex in your terminal. This installs the Codex command. OpenAI also documents standalone installers for macOS, Linux, and Windows, plus a Homebrew option; use one installation method for this walkthrough.

    If installation fails, read the exact error before retrying. A missing npm command means this route’s prerequisite is absent. Use the official operating-system installer or repair your npm setup rather than repeatedly running the same command.

    If codex is still not recognized after installation, open a fresh terminal and try again. If it remains unavailable, check the chosen installer’s output and your command search path before proceeding.

  2. Step 2: Enter your project folder and sign in

    In the terminal, use cd followed by your website folder path. Put the path in quotes if it contains spaces. Check the files in that folder and confirm it contains the intended website before starting Codex.

    Run codex. The first run offers sign-in; choose Sign in with ChatGPT for subscription access and complete the browser flow. Other supported authentication methods depend on your account and setup.

    For a sign-in problem, run codex login status in a separate terminal to inspect the active method. Use codex login to complete the documented browser sign-in flow. Keep API keys out of prompts and screenshots.

  3. Step 3: Ask Codex to explain what it sees

    Before asking for an edit, send: “Explain this website project, identify the startup and check commands, and tell me the directory you are working in. Do not change files.”

    Compare the answer with your project’s README and files. Codex works against the directory where you started it, so a convincing explanation of the wrong project is still the wrong starting point.

    If the folder is wrong, start a new CLI session from the correct folder. If the setup is incomplete, complete the documented setup before relying on a test result.

    Illustrated exampleMatch the terminal session to your website
    Example terminal

    In your shell

    cd "/Users/you/Websites/northline"

    pwd

    /Users/you/Websites/northline

    ls

    README.md  package.json  src

    codex

    Then, inside Codex

    Explain this website project, identify the startup and check commands, and tell me the directory you are working in. Do not change files.
    Illustrated session, not exact CLI output. Start in your project folder, then compare Codex’s explanation with the files and README before asking for edits.
  4. Step 4: Describe one small edit and its check

    Use the prompt below for a focused task. A good first example is changing the text of one home-page button while preserving its destination and appearance.

    Supply the exact old and new text, the page route, and the expected result. Ask Codex to read the relevant files, preserve unrelated changes, and use the project’s existing checks.

    The CLI can edit files and run local tools within its configured permissions. Read commands and approval requests as they appear. If access is blocked, ask for the exact limitation and a way to perform the needed check yourself rather than granting broad access by habit.

  5. Step 5: Inspect the edits and run the website

    Read Codex’s final summary and inspect the changed files using your editor or normal Git diff view. The new wording should appear only where requested, and existing unrelated edits should remain intact.

    Review which checks actually ran and what they returned. If a command was unavailable or failed to start, it is an unfinished check. Ask Codex to identify the missing prerequisite and rerun the same relevant check after it is fixed.

    Open the website with its documented preview command, or use the preview already running for this folder. Verify the updated text, click the button, and check that its original destination and nearby links still work.

    Illustrated exampleReview one wording change in two places
    1Inspect the file edit

    src/app/page.tsx

    <a href="/contact">Get in touchRequest a quote</a>

    Destination stays /contact

    2Check the running page
    Example preview · Home /
    NORTHLINEA home that feels like you.Request a quote
    1. Read the new wording on Home.
    2. Click it: the Contact page opens.
    3. Try a nearby unchanged link.

    Record the evidenceInclude the exact check command and its actual result. A command that could not run still needs to be checked.

    In this example, “Get in touch” becomes “Request a quote” on Home. Inspect the diff, run the project’s checks, then verify the button still opens Contact in your preview.
  6. Step 6: Correct a mismatch and save the working version

    If the visible result is wrong, continue in the same session with the exact page, action, and unexpected result. Ask for one targeted correction and inspect the new diff. Do not stack several unrelated requests on top of an unchecked result.

    If you need to return later, run codex resume from your project to reopen a saved chat. A resumed conversation does not restore an older copy of your files; review the current working tree before continuing.

    After the checks and manual preview agree, save a new working copy or Git checkpoint. Keep the final report with the commands and any remaining limitations so you know what was verified.

You're done when

  • The codex command starts successfully and your sign-in works in the intended project directory.
  • The file changes match the requested edit and preserve unrelated work.
  • The visible website result and a nearby unchanged behavior both pass your manual check.
  • You have recorded actual check outcomes, resolved relevant failures, and saved the reviewed version.

Your prompt

Show promptHide prompt

COPY AND PASTE

Make one focused change in this local website.

Page: [route]
Current behavior or wording: [exact current result]
Desired behavior or wording: [exact expected result]
Relevant file, if known: [file path or not known]
Verification: [existing command and manual steps, or ask Codex to identify them]

Confirm the working directory and inspect the relevant files before editing. Preserve unrelated work and keep other behavior and styling unchanged. Use the existing project tools and run the relevant checks where available. Finish with the changed files, commands actually run, results, anything you could not verify, and steps for checking the page myself. Do not commit or publish.

Paste this into the interactive Codex CLI after starting codex from your website folder and signing in. Do not paste it into your shell as a terminal command.

FREE BY EMAIL

Get the full AI guide

Our complete, step-by-step guide to using AI in your business, sent straight to your inbox.

Keep goingMore Codex guidesReturn to Codex for more practical guides and launch notes.

Get every new tool guide in your inbox

When a tool drops a new feature, you get the breakdown: what it is, how it works, and how to use it.

By subscribing, you agree to receive the tool guides newsletter. Unsubscribe anytime.