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_
23 Comments
This is my config.toml
This issue seems to have popped up within the last day or so (I'm assuming with the latest release)
<img width="1144" height="764" alt="Image" src="https://github.com/user-attachments/assets/27a47bc0-d0c7-4ae7-a608-24928c9bb3c9" />
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-aarch64Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
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/nodeReproducing with CLI on macOS
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?
yes I am having the issue, but it works randomly, i can put a screen recording maybe
This is occurring with me also, started within the last few days.
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
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
setoption inshell_environment_policy; it did update$PATH, but the entries were appended instead of prepended, so/usr/local/binstill took priority. Similar to what @mickg10 found outfor me,
add this line in the end of ~/.profile
you can use
nano ~/.profileto edit thatThis command can get the node's path
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
does any good because (probably?) the PATH has been already lost in previous fork or something.
Any other agent just inherits by default.
說個簡單的解法,用Homebrew安裝就沒有這個問題了,環境變數、設定都不用改
Could you try to enable the shell snapshot (throught
/experimentalfrom the CLI and then do a new session/new) and tell me if the issue persists?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.
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
openai.chatgpt@0.4.74codex-cli 0.100.0-alpha.10zshnvm,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:
Observed in Codex:
which node->node not foundnode -v-> command not foundwhich markitdown-> not foundAt the same time, login shell works:
and all tools are found there.
Notes about config flags
I also tested:
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.: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.
The cause is likely the following section in .bashrc. The behavior differs in non-interactive mode.
Just use
brew install codexinstall brew version, you don't need to edit any env or configif someone like use
miseto manage global dev tools , and did puteval "$(mise activate bash)"in bashrc or some custom path that would source.add
eval "$(mise activate --shims)"to prepend mise shim path toPATH, so that even when codex execute commands likepnpm --versionin 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.Adding a related macOS/Kitty data point, with a minimal reproducer.
Environment:
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:
Minimal reproducer from an existing Kitty window:
In my case the launched child did not see /opt/homebrew/bin in PATH, so the shebang
#!/usr/bin/env nodein /opt/homebrew/bin/codex failed. Passing PATH explicitly fixes it:A Kitty-level workaround for future Kitty children is:
That config appears to require a Kitty restart;
kitty @ load-configalone 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 onenv node.