You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
codex fails to launch on macOS due to unsupported env -S shebang #42
The -S flag is a GNU extension to env, and is not supported on macOS, which uses BSD coreutils by default. As a result, this shebang is not portable and fails with a confusing error.
✅ Proposed fix
Update the shebang in the codex launcher script to use a more portable invocation:
➜ npm install -g @openai/codex
npm warn deprecated phin@2.9.3: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated lodash.isequal@4.5.0: This package is deprecated. Use require('node:util').isDeepStrictEqual instead.
removed 63 packages, and changed 326 packages in 10s
84 packages are looking for funding
run `npm fund` for details
➜ head -n1 /Users/werner/.nvm/versions/node/v22.14.0/bin/codex
#!/usr/bin/env -S NODE_OPTIONS=--no-deprecation node
➜ codex --version
0.1.4161114
Where do you get that -S is "not supported on macOS"? Per the manpage, "The -P, -S and -v options were added in FreeBSD 6.0." — that was released in 2005.
Copilot is arguing that the npm package fails when parsed as a shebang in the generated wrapper script, that the "generated global binary (the shim) is interpreted differently than a direct node call or shell script."
The workaround is solid for me, and there are others already reporting similar issues.
Note the GNU implementation was modeled after FreeBSD, which implemented the -S options since FreeBSD 5.5 (2008).
It looks like your env(1) is trying to execute NODE_OPTIONS=--no-deprecation rather than taking it as a directive to set that env var. Testing on GNU, macOS 12.7.4, FreeBSD 15, and macOS 15.4 at least show the expected interpretation of an env var setting for any entry containing '='. You can test this with env -vS'FOO=bar true'
Activity
tibo-openai commentedon Apr 16, 2025
Thank you for the detailed issue description, proposed fix looks good, please send a PR!
dahifi commentedon Apr 16, 2025
Not sure if the PR is any good, but wanted the workaround out there in the meantime.
slhck commentedon Apr 16, 2025
FWIW I am on macOS and it runs just fine:
Where do you get that
-Sis "not supported on macOS"? Per the manpage, "The -P, -S and -v options were added in FreeBSD 6.0." — that was released in 2005.dahifi commentedon Apr 16, 2025
Copilot is arguing that the npm package fails when parsed as a shebang in the generated wrapper script, that the "generated global binary (the shim) is interpreted differently than a direct node call or shell script."
The workaround is solid for me, and there are others already reporting similar issues.
jacob-israel-turner commentedon Apr 16, 2025
I had the same issue, and @dahifi's workaround seems to be working for me so far.
jonchurch commentedon Apr 16, 2025
This should be closed now with #96, once a new version is released
pixelb commentedon Apr 17, 2025
Note the GNU implementation was modeled after FreeBSD, which implemented the
-Soptions since FreeBSD 5.5 (2008).It looks like your env(1) is trying to execute
NODE_OPTIONS=--no-deprecationrather than taking it as a directive to set that env var. Testing on GNU, macOS 12.7.4, FreeBSD 15, and macOS 15.4 at least show the expected interpretation of an env var setting for any entry containing '='. You can test this withenv -vS'FOO=bar true'It would be interesting to see output from
env -vS'FOO=bar true'on a system that had this issue to see if they also have this operationfix(gui): equalize image preview spacing (openai#42)
fix(npm,release): installer correctness and publish ordering
fix(linux-sandbox): deny /dev symlinks and host-only netns sysctls by…