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
I see /bin/ps: Operation not permitted](shellenv.sh: line 18: /bin/ps: Operation not permitted) on any command, not just rg. NB: the command succeeds, but the model sees the error and comments on it.
And zsh runs inside the sandbox, which doesn't allow ps
Reacted by Kris Kaczor, Sergio Kovtunenko, AkihiroOkayama, Youichi Otani, Ethan-Yys, Sofia Casadei, Amir Hasanbasic, itmammoth, Glenn 'devalias' Grant, Sam Ilic and 1 more
Alternatively, get the path of codex, for example:
which codex
/opt/homebrew/bin/codex
On macOS, System Settings -> Privacy & Security -> Full Disk Access, select +, add the codex binary file:
Reacted by Fan He, Eric Moore, mason, Stephen Lizcano, AHpx, l-ning, junyi-sahara, Lucas and Alishan Ladhani
Reacted by Georgii Kostenko, Yanchen Chen, Timmy Jose, Allen, tummetott, alamothe, tony-snyder-fc, Noob Tsai, Brian Vanderwal, Lawrence Khadka and 1 more
I worked around this by replacing the existing shellenv eval with this in .zprofile:
# Only run Homebrew shellenv in interactive shells,
# and only if brew actually exists.
if [[ $- == *i* ]] && [[ -x /opt/homebrew/bin/brew ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
So far seems to be working for me.
Reacted by Dan Washusen, Wr0eman, Yaroslav Lapin, bash, Annenpolka, Martin Komara, James Deane, Yanchen Chen, GWXia, H4dr1en and 30 more
Reacted by Sofia Casadei, Simon, Joonas Pihlajamaa, Felipe Sabino, weishu, Frank Epperlein, Glenn 'devalias' Grant and Ostap Brehin
I worked around this by replacing the existing shellenv eval with this in .zprofile:
# Only run Homebrew shellenv in interactive shells,
# and only if brew actually exists.
if [[ $- == *i* ]] && [[ -x /opt/homebrew/bin/brew ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
So far seems to be working for me.
@GringoDotDev
Thank you. I was saved by your content.
I think this is something codex developers should fix, any workaround in this area is just a patch.
Reacted by Tristan Yang, Alex Ehlke, Brian Voskerijian, Nate Silva, itmammoth, Ross Campbell, publicqi, Elliott W, Ryan Kophs, Casper Kristiansson and 17 more
Alternatively, get the path of codex, for example:
which codex
/opt/homebrew/bin/codex
On macOS, System Settings -> Privacy & Security -> Full Disk Access, select +, add the codex binary file:
In fact, I was unable to add it successfully on my macOS version(26.1).
I was facing the same on macOS 26.2 with Codex installed from Node. I then removed it completely and installed 0.77 using brew. Then I got a prompt asking permission to run the app I downloaded from the internet. After saying yes, stuff started to work again.
Codex runs commands via a login shell (zsh -lc), which executes ~/.zprofile. If that file runs brew shellenv, Homebrew tries to call /bin/ps to detect the parent shell, and macOS Seatbelt blocks that call, producing the “Operation not permitted” message on stderr.
As a potential workaround, enable the shell_snapshot experimental feature using the /experimental slash command. Let us know if that resolves the problem.
This bug hasn't been upvoted or commented in in two months. I suspect it's no longer an issue. I'm going to close. If you're still seeing this, please use /feedback to open a new bug report and include your thread ID.
Activity
tekumara commentedon Oct 3, 2025
I see
/bin/ps: Operation not permitted](shellenv.sh: line 18: /bin/ps: Operation not permitted)on any command, not justrg. NB: the command succeeds, but the model sees the error and comments on it.I think it's because shellenv.sh is in .zprofile:
And zsh runs inside the sandbox, which doesn't allow
psxab3r commentedon Oct 4, 2025
I use GNU bash as the shell and have the same problem. This worked for me:
Steps to reproduce:
$ codex ▌ run 'echo $PATH'fix(codex): operation not permitted
tekumara commentedon Oct 4, 2025
Thanks @xab3r that avoids running /bin/ps here and worked for me!
aehlke commentedon Oct 10, 2025
Sorry I am a bit dumb - what do you do with this eval?
edit: Oh, put it in zprofile
specify shell so it works well with codex
skovtunenko commentedon Oct 28, 2025
Thank you @xab3r , this is working for me as well.
My default shell is
fish, but adding those instructions to.bash_profilesolved a problem.songkeys commentedon Nov 4, 2025
Alternatively, get the path of
codex, for example:On macOS, System Settings -> Privacy & Security -> Full Disk Access, select
+, add thecodexbinary file:GringoDotDev commentedon Nov 20, 2025
I worked around this by replacing the existing shellenv eval with this in .zprofile:
So far seems to be working for me.
ishibashi-futos commentedon Nov 21, 2025
@GringoDotDev
Thank you. I was saved by your content.
iagooar commentedon Nov 30, 2025
I think this is something
codexdevelopers should fix, any workaround in this area is just a patch.vaspike commentedon Dec 3, 2025
In fact, I was unable to add it successfully on my macOS version(26.1).
fliingelephant commentedon Dec 18, 2025
Same for macOS 26.2
slaterx commentedon Dec 24, 2025
I was facing the same on macOS 26.2 with Codex installed from Node. I then removed it completely and installed 0.77 using brew. Then I got a prompt asking permission to run the app I downloaded from the internet. After saying yes, stuff started to work again.
lgh06 commentedon Jan 6, 2026
same bug in codex-cli 0.77.0
installed from npm
priyathamkat commentedon Jan 7, 2026
I see this bug too on
codex 0.79.0etraut-openai commentedon Jan 28, 2026
Codex runs commands via a login shell (
zsh -lc), which executes ~/.zprofile. If that file runs brew shellenv, Homebrew tries to call /bin/ps to detect the parent shell, and macOS Seatbelt blocks that call, producing the “Operation not permitted” message on stderr.As a potential workaround, enable the
shell_snapshotexperimental feature using the/experimentalslash command. Let us know if that resolves the problem.etraut-openai commentedon Mar 29, 2026
This bug hasn't been upvoted or commented in in two months. I suspect it's no longer an issue. I'm going to close. If you're still seeing this, please use
/feedbackto open a new bug report and include your thread ID.