ripgrep operation not permitted
Resolved 💬 16 comments Opened Oct 2, 2025 by aehlke Closed Mar 29, 2026
💡 Likely answer: A maintainer (tekumara, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
0.42.0
Which model were you using?
_No response_
What platform is your computer?
_No response_
What steps can reproduce the bug?
I get this error when codex tries to use rg:
• Ran zsh -lc 'rg "tabSelection = .reader" -n'
└ /opt/homebrew/Homebrew/Library/Homebrew/cmd/shellenv.sh: line 18: /bin/ps: Operation not permitted
Something in my environment must be breaking this. Please advise... not sure how to debug this.
What is the expected behavior?
_No response_
What do you see instead?
_No response_
Additional information
_No response_
16 Comments
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
psI use GNU bash as the shell and have the same problem. This worked for me:
Steps to reproduce:
Thanks @xab3r that avoids running /bin/ps here and worked for me!
Sorry I am a bit dumb - what do you do with this eval?
edit: Oh, put it in zprofile
Thank you @xab3r , this is working for me as well.
My default shell is
fish, but adding those instructions to.bash_profilesolved a problem.Alternatively, get the path of
codex, for example:On macOS, System Settings -> Privacy & Security -> Full Disk Access, select
+, add thecodexbinary file:<img width="471" height="52" alt="Image" src="https://github.com/user-attachments/assets/796716ec-2375-4a95-9176-561a4c3f3600" />
I worked around this by replacing the existing shellenv eval with this in .zprofile:
So far seems to be working for me.
@GringoDotDev
Thank you. I was saved by your content.
I think this is something
codexdevelopers should fix, any workaround in this area is just a patch.In fact, I was unable to add it successfully on my macOS version(26.1).
Same for macOS 26.2
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.
same bug in codex-cli 0.77.0
installed from npm
I see this bug too on
codex 0.79.0Codex 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.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.