Codexgeneral

codex: command not found After Installing the Codex CLI

You installed the Codex CLI but the terminal says command not found. The usual causes: the wrong package, an old Node version, or a missing PATH entry.

2 min read Updated Applies to Codex

What is going on

You installed the Codex command line tool, but typing codex in the terminal gives command not found (or 'codex' is not recognized on Windows).

Most of the time the install worked. The terminal just does not know where the program was put.

Error messages you might see

codex: command not found
zsh: command not found: codex
'codex' is not recognized as an internal or external command
npm ERR! code EACCES

Common causes

  1. The folder where npm puts global programs is not on your PATH, so the shell cannot see the new command.
  2. You installed the wrong package. The correct one is @openai/codex. The package named just codex on npm is an unrelated project.
  3. Your Node.js version is too old. Guides disagree on the minimum, and a recent version (Node 22 or newer) is the safer choice.
  4. The install failed with a permissions error (EACCES) that scrolled past.
  5. You installed it, then opened the terminal that was already open before the install, which has not picked up the new PATH.

How to fix it

These steps come from public install guides and user reports.

  1. Check your Node version with node --version. If it is old, update Node and install again.
  2. Install the right package: npm install -g @openai/codex.
  3. Find where npm puts global programs: run npm prefix -g. The commands live in the bin folder inside that path.
  4. Add that bin folder to your PATH in your shell profile (for example ~/.zshrc), or in your user PATH settings on Windows, then open a new terminal.
  5. Check with codex --version.
  6. If the install says permission denied, do not use sudo. Point npm at a folder you own with npm config set prefix ~/.npm-global, add its bin folder to PATH, and install again.

Getting help takes about a minute

No hiring, no back and forth. A real person looks at your app.

  1. 1

    Describe it

    Tell us what you need in plain words. You don't have to be technical or have an account to start.

  2. 2

    Free 15-minute call

    A verified developer calls you. Many tasks are sorted right there, and it costs nothing.

  3. 3

    Pay after you approve

    If there is more to do, you get one fixed price up front. You pay only once you are happy.

Get help

Real people, reviewed by hand

Developers who do this every day

Every developer is approved by our team before they can take a task. Describe yours and the first one who is free picks it up.

Get help
Matthew Butler Matthew Butler Java · Python · C/C++ · Kubernetes · Amazon Web Services Systems Development Engineer @ Amazon Web Services Jacek Rozanski Jacek Rozanski react · nextjs · supabase · typescript · tailwind · php · symfony · postgresql · mysql · docker · aws · node.js · stripe · api integrations · ci/cd · devops Senior PHP/Symfony developer and DevOps engineer with 20+ years of professional experience, running opcode.pl (web development agency, est. 2004). Day job: I'm the sole backend developer at merketing company where I own and maintain 11 PHP/Symfony microservices on AWS (ECS Fargate, RDS, S3, CloudFront), handle the full CI/CD pipeline (Bitbucket Pipelines, Docker), and manage monitoring with Sentry and CloudWatch. These services handle high request volumes in production every month. What I bring to AI-built apps: - I audit and fix security issues (OWASP methodology), performance bottlenecks, and architectural problems in codebases generated by Cursor, Claude Code, Lovable, Bolt, and v0 - I refactor AI-generated prototypes into production-grade applications with proper error handling, testing, and clean architecture (SOLID, DDD, hexagonal architecture) - I set up the infrastructure AI tools don't touch: AWS hosting, CI/CD pipelines, automated deployments, database optimization, monitoring, and alerting - I integrate external services: payment providers, email systems, partner APIs, SSO/auth Tech stack: PHP 8.x, Symfony, React, Next.js, PostgreSQL, MySQL, Docker, AWS (ECS, RDS, S3, SQS/SNS, CloudFront), Terraform, Supabase. I also use AI tools daily (Claude Code, Cursor) in my own workflow, so I understand both the strengths and the gaps in AI-generated code. Based in Poland (CET timezone). Available for async work and calls during EU/US business hours. BurnHavoc BurnHavoc if it has a spec · doc or manpage · I know it Been around fixing other peoples code for 20 years.

Questions

Which package do I install?

@openai/codex. Installing the package named just codex gives you an unrelated program.

Do I need sudo?

No. Needing sudo means npm is set up to write to a protected folder. Change npm's global folder to one you own instead.

Keep reading

Can't fix it yourself?
Real developers can help.

Get help