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_

View original on GitHub ↗

16 Comments

tekumara contributor · 9 months ago

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.

I think it's because shellenv.sh is in .zprofile:

❯ cat ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

And zsh runs inside the sandbox, which doesn't allow ps

xab3r · 9 months ago

I use GNU bash as the shell and have the same problem. This worked for me:

# eval $(/opt/homebrew/bin/brew shellenv)
eval $(/opt/homebrew/bin/brew shellenv bash)

Steps to reproduce:

$ codex
▌ run 'echo $PATH'
tekumara contributor · 9 months ago

Thanks @xab3r that avoids running /bin/ps here and worked for me!

aehlke · 9 months ago
I use GNU bash as the shell and have the same problem. This worked for me:

Sorry I am a bit dumb - what do you do with this eval?

edit: Oh, put it in zprofile

skovtunenko · 8 months ago
I use GNU bash as the shell and have the same problem. This worked for me: eval $(/opt/homebrew/bin/brew shellenv bash)

Thank you @xab3r , this is working for me as well.
My default shell is fish, but adding those instructions to .bash_profile solved a problem.

songkeys · 8 months ago

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:

<img width="471" height="52" alt="Image" src="https://github.com/user-attachments/assets/796716ec-2375-4a95-9176-561a4c3f3600" />

GringoDotDev · 8 months ago

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.

ishibashi-futos · 8 months ago
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.

iagooar · 7 months ago

I think this is something codex developers should fix, any workaround in this area is just a patch.

vaspike · 7 months ago
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: <img alt="Image" width="471" height="52" src="https://private-user-images.githubusercontent.com/22665058/509644034-796716ec-2375-4a95-9176-561a4c3f3600.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjQ3MjU4NjAsIm5iZiI6MTc2NDcyNTU2MCwicGF0aCI6Ii8yMjY2NTA1OC81MDk2NDQwMzQtNzk2NzE2ZWMtMjM3NS00YTk1LTkxNzYtNTYxYTRjM2YzNjAwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTEyMDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUxMjAzVDAxMzI0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEzM2Q3NTE5M2NhYjlhYmE2YmEyMjk0Yzc3YmUxOTAxMDI3YmZjYzBkMzYyOTA0NzMxOTMzYmEwMmI2NTIyMDAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.3AUzkJacMcNik_oxWD5gSKgrI1_IulN1XJJWr5UZlGk">

In fact, I was unable to add it successfully on my macOS version(26.1).

fliingelephant · 7 months ago
> 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: > <img alt="Image" width="471" height="52" src="https://private-user-images.githubusercontent.com/22665058/509644034-796716ec-2375-4a95-9176-561a4c3f3600.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjQ3MjU4NjAsIm5iZiI6MTc2NDcyNTU2MCwicGF0aCI6Ii8yMjY2NTA1OC81MDk2NDQwMzQtNzk2NzE2ZWMtMjM3NS00YTk1LTkxNzYtNTYxYTRjM2YzNjAwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTEyMDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUxMjAzVDAxMzI0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEzM2Q3NTE5M2NhYjlhYmE2YmEyMjk0Yzc3YmUxOTAxMDI3YmZjYzBkMzYyOTA0NzMxOTMzYmEwMmI2NTIyMDAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.3AUzkJacMcNik_oxWD5gSKgrI1_IulN1XJJWr5UZlGk"> In fact, I was unable to add it successfully on my macOS version(26.1).

Same for macOS 26.2

slaterx · 6 months ago

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 · 6 months ago

same bug in codex-cli 0.77.0
installed from npm

priyathamkat · 6 months ago

I see this bug too on codex 0.79.0

etraut-openai contributor · 5 months ago

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.

etraut-openai contributor · 3 months ago

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.