AI TOOL SETUP · 9 min read
How to Set Up Codex on Your Computer (Mac & PC, Step by Step)
Codex is OpenAI's coding agent that runs locally on your machine. Unlike a browser chat window, it can read a real project folder, make changes, run the project, and report back. For an owner that wants to use AI to actually move files, fix a spreadsheet macro, patch a broken site, or build a small internal tool, Codex is the door in.
This guide installs Codex from scratch on macOS and on Windows, runs the first task end to end, and shows how to recover from the three errors that hit almost every beginner. You do not need prior command-line experience to follow it.
What Codex is
Codex is a coding-focused agent from OpenAI. It is delivered as a small program you install on your computer. You point it at a folder, you give it an instruction, and it edits files, runs commands, and shows you what changed. The difference between Codex and the chat box in a browser is that Codex actually does the work in your project. Chat gives you a snippet. Codex changes the file and runs the test.
For a service-business owner the practical use cases are small internal tools, quick data clean-ups, website tweaks, and one-off scripts that would otherwise sit on a quote from a developer for three weeks. It is not a tool for non-technical document clean-up. For that, the better fit is Claude Cowork, covered in our Claude Cowork setup guide.
Requirements
- An OpenAI account with API access enabled and a payment method on file. Codex consumes API credits per run, not a flat monthly fee.
- macOS 13 or newer, or Windows 10 or 11. Linux works too but is out of scope for this guide.
- A working install of Node.js 18 or newer. The Codex installer uses it. If you do not have it, install the LTS build from nodejs.org first.
- Administrator rights on your computer.
- About 500 MB of free disk space.
- A small test project folder. Make a folder on your Desktop called codex-sandbox with one simple file inside (for example a plain text file with a list of products).
Make sure Node.js is installed before you start the rest. The single most common install failure is Codex trying to run before Node is on the PATH.
Install on Mac
- Install Node.js. Download the LTS macOS installer from nodejs.org and run it. Approve the prompts. When it finishes, open the Terminal app and run node -v. You should see a version number.
- Open Terminal. Spotlight (Cmd-Space), type Terminal, press Enter. You only need to type the commands below. You will not be writing code.
- Install Codex. Run npm install -g @openai/codex. Wait for it to finish. If it complains about permissions, run it again with sudo in front and type your password.
- Add your API key. Go to platform.openai.com, generate a key, copy it. Back in Terminal, run export OPENAI_API_KEY=sk-your-key-here. To make that stick across reboots, add the same line to the bottom of your ~/.zshrc file.
- Test the install. Run codex --version. You should see a version number, not an error.
- Open your sandbox. Type cd ~/Desktop/codex-sandbox and press Enter. Then run codex. The agent opens inside that folder and is ready for your first instruction.
Install on Windows
- Install Node.js. Download the LTS Windows installer from nodejs.org. Accept the defaults, including the option to add Node to your PATH. Reboot if asked.
- Open Windows Terminal or PowerShell. Press the Windows key, type Terminal, and press Enter. If you do not have Windows Terminal, search for PowerShell and use that.
- Confirm Node. Run node -v. You should see a version. If you see "not recognized," close and reopen the Terminal so it picks up the updated PATH.
- Install Codex. Run npm install -g @openai/codex.
- Set your API key. Run setx OPENAI_API_KEY "sk-your-key-here". Close and reopen Terminal so the new environment variable is loaded.
- Test. Run codex --version. You should see a version.
- Open your sandbox. Run cd $env:USERPROFILE\Desktop\codex-sandbox, then codex. Codex opens in that folder.
Your first run
Once Codex is open in the sandbox folder, type a simple, verifiable instruction. For example: "Read the product list in products.txt and write a small HTML page called index.html that displays each product as a card."
Codex will plan the work, propose the edits, and ask for permission before each step that touches a file. Approve the changes you want, reject the ones you do not. Then open the file in your browser to see the result.
The right mental model is: Codex is a junior developer who works in five-minute bursts and shows you the diff. The skill is giving small, well-scoped tasks and actually reading what it produces.
Troubleshooting
- "command not found: codex" on Mac, or "not recognized" on Windows. Node is not on your PATH or the install did not finish. Close and reopen the Terminal. If that does not fix it, reinstall Node.js from nodejs.org and rerun the npm install -g @openai/codex step.
- "Missing API key." Your OPENAI_API_KEY is not loaded in the current shell. On Mac add the export line to ~/.zshrc. On Windows close and reopen the Terminal after running setx.
- Quota or billing errors. Codex uses the OpenAI API, which is pay-as-you-go. Confirm you have a payment method on file and a usage cap that is not already exceeded.
- It is running tasks you did not approve. You may have started Codex in an unattended mode. Quit and restart it in interactive mode so it asks before each change.
Where to go next
If you already use Claude or want to compare the two before you commit, read our Claude Cowork vs Codex comparison. If you would rather skip the trial-and-error and install everything live with us, the Cowork-based 1:1 AI Setup Training is bookable today and the dedicated Codex 1:1 training is coming soon.
Frequently asked questions
Is Codex free?
The Codex agent itself is free to install. Every task it runs uses the OpenAI API and is billed by usage. Most owner-scale tasks cost cents, not dollars, but watch your usage cap when you start.
Do I have to use the terminal forever?
You only use the terminal to open Codex in a folder. After that you are typing in plain English. Most owners get comfortable with the four or five commands above and never go deeper.
Can Codex break my project?
Only if you let it. Run Codex in interactive mode, read every diff before you approve, and keep your project in version control. Treat it like a junior who is fast but inexperienced.
Can I run Codex and Claude Cowork on the same machine?
Yes. They do not conflict. Many owners use Claude Cowork for document and content work and Codex for small code and scripting tasks.
Two ways to keep going
Book a free consult to talk through your own setup, or learn it live with us.
Want a workflow expert to look at yours?
Book a free AI Readiness Consult. We will map your call flow, your CRM, and your follow-up, then tell you the smallest move that pays for itself first.