Codex PATH seems to no longer match system PATH (can't run `node`)

Open 💬 23 comments Opened Nov 5, 2025 by matthew-plusprogramming
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of the VS Code extension are you using?

0.4.35

What subscription do you have?

Plus

Which IDE are you using?

VS Code

What platform is your computer?

Darwin 24.6.0 arm64 arm

What issue are you seeing?

So recently my codex agent stopped being able to run commands like node and such. After a little debugging my guess is that the PATH variable no longer matches my system's PATH and so it can't find my node executable and similar executables.

What steps can reproduce the bug?

I just said Try running node and it cannot find the node executable. Although it works when I run on my terminal.

What is the expected behavior?

The agent should be able to run a command like node --version

Additional information

_No response_

View original on GitHub ↗

23 Comments

matthew-plusprogramming · 8 months ago
show_raw_agent_reasoning = true
model = "gpt-5-codex"
model_reasoning_effort = "high"

[history]
persistence = "none"

This is my config.toml

matthew-plusprogramming · 8 months ago

This issue seems to have popped up within the last day or so (I'm assuming with the latest release)

matthew-plusprogramming · 8 months ago

<img width="1144" height="764" alt="Image" src="https://github.com/user-attachments/assets/27a47bc0-d0c7-4ae7-a608-24928c9bb3c9" />

matthew-plusprogramming · 8 months ago

I see my PATH var in codex is: /usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/var/folders/cm/v2bwd87d0j92gmwh2610vkhh0000gn/T/.tmpM2Y02l:/Users/matthewlin/.vscode/extensions/openai.chatgpt-0.4.35-darwin-arm64/bin/macos-aarch64

github-actions[bot] contributor · 8 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #6218
  • #5837
  • #4843

Powered by Codex Action

matthew-plusprogramming · 8 months ago

As a temporary workaround I have symlinked executables needed to systemwide PATH directories:

e.g.: sudo ln -s /Users/matthewlin/.nvm/versions/node/v22.14.0/bin/node /usr/local/bin/node

mudkipdev · 8 months ago

Reproducing with CLI on macOS

mudkipdev · 8 months ago

actually, I tested it on all versions from 0.52 to 0.55 and it seems to be working 50/50 at complete random on all of them..

matthew-plusprogramming · 8 months ago
actually, I tested it on all versions from 0.52 to 0.55 and it seems to be working 50/50 at complete random on all of them..

Sorry what do you mean by this? Are you saying that you're having the same issue, or cannot reproduce?

mudkipdev · 8 months ago

yes I am having the issue, but it works randomly, i can put a screen recording maybe

zz-koji · 8 months ago

This is occurring with me also, started within the last few days.

mickg10 · 8 months ago

So, looking at the thing - codex seems to prepend a LOT of things to the path - it does preserve it, but prepends

/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/
usr/appleinternal/bin:/opt/pmk/env/global/bin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/var/folders/_y/x2bbjyps5831190g955y91_h0000gn/T/.tmpZ800wO:/Users/mickg10/.nvm/versions/node/v25.1.0/lib/node_modules/@openai/codex/vendor/aarch64-apple-darwin/
path

Any idea how to turn that off?

(aesthetic) [mickg10@Mac.mickg.net](mailto:mickg10@Mac.mickg.net) ~/src/improved_aesthetic-predictor 7088 > cat ~/.codex/config.toml; echo $PATH; (export BAR=1234; export PATH=FOO:$PATH; codex -s danger-full-access --dangerously-bypass-approvals-and-sandbox -c model_reasoning_effort="high" -m gpt-5.1-codex --enable web_search_request 'Print me PATH env var and the BAR env var')
tui = { theme = { name = "dark-zen-garden" } }
model = "gpt-5.1-codex"
model_reasoning_effort = "high"

[tools]
websearch = true

features.web_search_request = true

tools.view_image = true

[shell_environment_policy]
inherit = "all"
ignore_default_excludes = true
experimental_use_profile = true

/Users/mickg10/miniconda3/envs/aesthetic/bin:/Users/mickg10/miniconda3/condabin:/Users/mickg10/.nvm/versions/node/v25.1.0/bin:/Users/mickg10/.cargo/bin:/Users/mickg10/.bun/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/opt/homebrew/opt/fzf/bin
╭──────────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.58.0) │
│ │
│ model: gpt-5.1-codex high /model to change │
│ directory: ~/src/improved_aesthetic-predictor │
╰──────────────────────────────────────────────────╯

To get started, describe a task or try one of these commands:

/init - create an AGENTS.md file with instructions for Codex
/status - show current session configuration
/approvals - choose what Codex can do without approval
/model - choose what model and reasoning effort to use
/review - review any changes and find issues

› Print me PATH env var and the BAR env var

• Ran echo "PATH=$PATH"; echo "BAR=$BAR"
└ PATH=/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/
usr/appleinternal/bin:/opt/pmk/env/global/bin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/var/folders/_y/x2bbjyps5831190g955y91_h0000gn/T/.tmpZ800wO:/Users/mickg10/.nvm/versions/node/v25.1.0/lib/node_modules/@openai/codex/vendor/aarch64-apple-darwin/
path:FOO:/Users/mickg10/miniconda3/envs/aesthetic/bin:/Users/mickg10/miniconda3/condabin:/Users/mickg10/.nvm/versions/node/v25.1.0/bin:/Users/mickg10/.cargo/bin:/Users/mickg10/.bun/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/fzf/bin
BAR=1234

─ Worked for 6s ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

• PATH=/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/
usr/appleinternal/bin:/opt/pmk/env/global/bin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/var/folders/_y/x2bbjyps5831190g955y91_h0000gn/T/.tmpZ800wO:/Users/mickg10/.nvm/versions/node/v25.1.0/lib/node_modules/@openai/codex/vendor/aarch64-apple-darwin/
path:FOO:/Users/mickg10/miniconda3/envs/aesthetic/bin:/Users/mickg10/miniconda3/condabin:/Users/mickg10/.nvm/versions/node/v25.1.0/bin:/Users/mickg10/.cargo/bin:/Users/mickg10/.bun/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/fzf/bin
BAR=1234

icaroryan · 8 months ago

My workaround was to add the path override to ~/.profile:
export PATH="$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"

I originally had the issue while using rbenv, but the same approach should work for this. I also tried the set option in shell_environment_policy; it did update $PATH, but the entries were appended instead of prepended, so /usr/local/bin still took priority. Similar to what @mickg10 found out

flier268 · 7 months ago

for me,
add this line in the end of ~/.profile

you can use nano ~/.profile to edit that

export PATH="$HOME/.nvm/versions/node/v22.20.0/bin:$PATH"

This command can get the node's path

node_bin_dir="$(dirname "$(nvm which current)")"
echo "$node_bin_dir"
zbynekwinkler · 5 months ago

Oh, this is so broken. How can anyone get anything done? The default needs to be inheriting the environment from the parent process all the way down. Not even

[shell_environment_policy]
inherit = "all"
ignore_default_excludes = true

does any good because (probably?) the PATH has been already lost in previous fork or something.

Any other agent just inherits by default.

flier268 · 5 months ago

說個簡單的解法,用Homebrew安裝就沒有這個問題了,環境變數、設定都不用改

jif-oai contributor · 5 months ago

Could you try to enable the shell snapshot (throught /experimental from the CLI and then do a new session /new) and tell me if the issue persists?

adamjhf · 5 months ago

This seemed to get fixed for me after upgrading from 0.91 to 0.92. In 0.92 it is working whether shell snapshot is on or off. My direnv hook now works with .envrc in Codex.

Forux · 5 months ago

I can confirm this is still happening for me on macOS, and in my case it is severe: Codex does not see my globally installed tools (for example node, markitdown, etc.) unless I force a manual PATH override.

Environment

  • IDE extension: openai.chatgpt@0.4.74
  • Codex CLI binary used by extension: codex-cli 0.100.0-alpha.10
  • OS: macOS (arm64)
  • Shell: zsh
  • Tools installed in user env (nvm, bun, etc.)

What changed / when

This started in my setup around 2026-02-13 (after extension/client updates around 2026-02-12..2026-02-13).
Before that, this worked normally.

Repro

From Codex agent/tool execution:

printenv PATH
which node
node -v
which markitdown

Observed in Codex:

  • which node -> node not found
  • node -v -> command not found
  • which markitdown -> not found

At the same time, login shell works:

zsh -lic 'which node; node -v; which markitdown; echo $PATH'

and all tools are found there.

Notes about config flags

I also tested:

[shell_environment_policy]
inherit = "all"
ignore_default_excludes = true
experimental_use_profile = true

but this did not reliably restore full login-shell visibility in my extension flow.

Current workaround (not acceptable long-term)

I have to hardcode PATH in ~/.codex/config.toml, e.g.:

[shell_environment_policy.set]
PATH = "..."

This is brittle and not equivalent to true shell environment inheritance (breaks when tool locations change, node version changes, etc.).

Expected behavior

Codex subprocess/tool execution should see the same user toolchain as normal shell usage (or a clearly documented and stable equivalent policy), without requiring manual PATH hardcoding.

Mushus · 4 months ago

The cause is likely the following section in .bashrc. The behavior differs in non-interactive mode.

  case $- in
      *i*) ;;
        *) return;;
  esac
flier268 · 4 months ago
I can confirm this is still happening for me on macOS, and in my case it is severe: Codex does not see my globally installed tools (for example node, markitdown, etc.) unless I force a manual PATH override. ## Environment - IDE extension: openai.chatgpt@0.4.74 - Codex CLI binary used by extension: codex-cli 0.100.0-alpha.10 - OS: macOS (arm64) - Shell: zsh - Tools installed in user env (nvm, bun, etc.) ## What changed / when This started in my setup around 2026-02-13 (after extension/client updates around 2026-02-12..2026-02-13). Before that, this worked normally. ## Repro From Codex agent/tool execution: ``sh printenv PATH which node node -v which markitdown ` Observed in Codex: - which node -> node not found - node -v -> command not found - which markitdown -> not found At the same time, login shell works: `sh zsh -lic 'which node; node -v; which markitdown; echo $PATH' ` and all tools are found there. ## Notes about config flags I also tested: `toml [shell_environment_policy] inherit = "all" ignore_default_excludes = true experimental_use_profile = true ` but this did not reliably restore full login-shell visibility in my extension flow. ## Current workaround (not acceptable long-term) I have to hardcode PATH in ~/.codex/config.toml, e.g.: `toml [shell_environment_policy.set] PATH = "..." `` This is brittle and not equivalent to true shell environment inheritance (breaks when tool locations change, node version changes, etc.). ## Expected behavior Codex subprocess/tool execution should see the same user toolchain as normal shell usage (or a clearly documented and stable equivalent policy), without requiring manual PATH hardcoding.

Just use brew install codex install brew version, you don't need to edit any env or config

hxlhxl · 3 months ago

if someone like use mise to manage global dev tools , and did put eval "$(mise activate bash)" in bashrc or some custom path that would source.
add eval "$(mise activate --shims)" to prepend mise shim path to PATH, so that even when codex execute commands like pnpm --version in a login non-interactive shell environment whose prompt doesn't exist, but login shell can get shim path and codex can execute mise-managed tools.

Don-Yin · 2 months ago

Adding a related macOS/Kitty data point, with a minimal reproducer.

Environment:

  • Codex CLI: 0.124.0
  • macOS: 26.4.1 arm64
  • Kitty: 0.46.1
  • install path: /opt/homebrew/bin/codex
  • node: /opt/homebrew/bin/node, v25.2.0

Symptom:
When Codex is launched by Kitty remote control from the Kitty app environment, the npm launcher can fail before the native Codex binary starts:

env: node: No such file or directory
/opt/homebrew/bin/codex: exit status 127

Minimal reproducer from an existing Kitty window:

kitty @ launch --type tab --hold --cwd "/Users/dy323/Dropbox/root-dir/research" /opt/homebrew/bin/codex --version

In my case the launched child did not see /opt/homebrew/bin in PATH, so the shebang #!/usr/bin/env node in /opt/homebrew/bin/codex failed. Passing PATH explicitly fixes it:

kitty @ launch --type tab --env "PATH=/Users/dy323/.codex/tmp/arg0/codex-arg0Lo8D8w:/opt/homebrew/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/path:/Users/dy323/.local/bin:/Users/dy323/micromamba/condabin:/Users/dy323/Dropbox/machine-setup/utils:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pkg/env/active/bin:/opt/pmk/env/global/bin:/Library/TeX/texbin:/Users/dy323/.cargo/bin:/Applications/kitty.app/Contents/MacOS:/Users/dy323/.orbstack/bin" --cwd "/Users/dy323/Dropbox/root-dir/research" /opt/homebrew/bin/codex --version

A Kitty-level workaround for future Kitty children is:

env read_from_shell=PATH LANG LC_* XDG_* EDITOR VISUAL

That config appears to require a Kitty restart; kitty @ load-config alone did not fix already-running Kitty's child environment in my test. This is related to the general PATH mismatch discussed here, but the failure happens even before Codex starts because the npm launcher depends on env node.