Continuous permission errors since 0.59->0.60, 5.1-Codex-Max upgrade
Resolved 💬 22 comments Opened Nov 20, 2025 by JeongJuhyeon Closed Mar 29, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
codex-cli 0.60.1
What subscription do you have?
Plus
Which model were you using?
5.1-codex-max
What platform is your computer?
MacOS, using zsh, installed Codex through Homebrew
What issue are you seeing?
Since updating 0.59->0.60 and switching to 5.1-Codex-Max, continuously seeing this:
• Explored
└ Read useDataScreen.ts
• I’m working on a new persistent store to track scroll offsets by format, using
│ *** Begin Patch
│ *** Add File: stores/dataUiStore.ts
│ … +53 lines
└ /opt/homebrew/Library/Homebrew/cmd/shellenv.sh: line 18: /bin/ps: Operation not permitted
Success. Updated the following files:
A stores/dataUiStore.ts
Ran cd /Users/sam/Developer/camera-app && apply_patch <<'PATCH'
│ *** Begin Patch
│ *** Update File: stores/hydration.ts
│ … +18 lines
└ /opt/homebrew/Library/Homebrew/cmd/shellenv.sh: line 18: /bin/ps: Operation not permitted
Success. Updated the following files:
M stores/hydration.ts
Note the repeated opt/homebrew/Library/Homebrew/cmd/shellenv.sh: line 18: /bin/ps: Operation not permitted as well as the use of && apply_patch <<'PATCH' which wasn't there before.
What steps can reproduce the bug?
Ask Codex to do virtually anything. It even happens when it does a sed.
Ran cd /Users/sam/Developer/camera-app && sed -n '1,200p' app/camera/[id].tsx
└ /opt/homebrew/Library/Homebrew/cmd/shellenv.sh: line 18: /bin/ps: Operation not permitted
zsh:1: no matches found: app/camera/[id].tsx
What is the expected behavior?
It didn't happen in 0.59.?, whatever I was on before.
Additional information
MacOS, using zsh, installed Codex through Homebrew
22 Comments
Thanks for the bug report. Could you use the
/feedbackslash command to upload the session and report the thread ID here?019a9f00-2f7c-7f70-ac97-61fd627822eb
Same here. Unfortunately I can't share my session but on Ubuntu Linux 22.04 LTS, Codex 0.60.1. This worked fine until about recent hours. It seems to be related to the sandbox. The folder is in a git repo and is whitelisted and has been used with Codex for over a month. I am unable to reproduce it with a new test repo. Codex eventually found a workaround by escalating every single command and writing Python scripts instead of using patch, but this is far from ideal.
`
• Tried renaming documentation/API Migration → documentation/
Response_Migration, but the documentation folder itself is not writable (even as
owner). Evidence:
I can proceed once the parent directory permissions/ACL allow creating/renaming
entries in documentation/. If you prefer, I can keep working inside the existing
API Migration folder until permissions are adjusted.
`
@zzhang1, what do you mean when you say the folder is "whitelisted"? Is it within the main working directory (where you launch
codex)? Or are you configuring additionalwritable_rootsin yourcodex.toml? Can you confirm that you are able to write to that directory yourself outside of the sandbox?same here
019a9fe2-a6be-75e2-b84e-4deeefa4e39afacing the same issue here
019a9fff-7753-7f23-85ef-d95519088b0cwith a simplergcommand.https://github.com/openai/codex/issues/4620#issuecomment-3559735331
Fixed this for me.
I fix this issue by explicitly specifying the terminal type in my
.zprofilefile.so that
shellenv.shwill not execute the code on line 18, as mentioned in #4620Interestingly, it all started working again this morning with no changes from my end.
Apologies for the confusion on 'whitelisting,' I just meant that the folder was trusted, e.g.,
[projects."/home/zzhang1/project"]
trust_level = "trusted"
When it wasn't working, I was still able to write and delete files in any of the project folders myself as the same user used to run Codex. Nothing looked strange in permissions via lsattr. And Codex could even write to them if it ran Python scripts on the fly to modify files.
019aba6e-eaf4-7170-bac0-8e92096afbe3
Same problem for me. Unfortunately, none of the fixes above work for me.
019ac430-d584-74a3-b596-e284568e0ff5
Same for me 019ae384-456a-7bd0-bbdc-bc6e53064942
same here, any commands, like git diff, or git status - 019ae9fa-79c5-79e2-b29f-f6469731e2ae;
codex-cli 0.64.0, 5.1-codex-max, macOS, zsh, installed via homebrew, but when I run it and it asked for update it was 'Updating Codex via
npm install -g @openai/codex@latest'upd.:
even after full update - brew update && brew upgrade && brew upgrade --cask && brew cleanup:
==> Upgrading 2 outdated packages:
codex 0.57.0 -> 0.64.0
session-manager-plugin 1.2.707.0 -> 1.2.764.0
==> Upgrading codex
All dependencies satisfied.
==> Unlinking Binary '/opt/homebrew/bin/codex'
==> Linking Binary 'codex-aarch64-apple-darwin' to '/opt/homebrew/bin/codex'
==> Purging files for version 0.57.0 of Cask codex
it shows the same:
/opt/homebrew/Library/Homebrew/cmd/shellenv.sh: line 18: /bin/ps: Operation not permitted
This one hurts real bad.
I'm praying that this problem will be solved by openAI more quickly
After some digging, I came to the following conclusions:
The regression was introduced in PR #7786 ("feat: add shell snapshot for shell command"), merged in commit
29381ba5c2. The goal was to support "shell snapshots" that capture a user's full environment (aliases, environment variables) by running commands in a login shell (zsh -lc). This change inadvertently made all shell commands run as login shells by default.The forced login shell sources the user's profile (
~/.zprofile), which typically runseval "$(/opt/homebrew/bin/brew shellenv)".The Issue:
In older versions of Homebrew (specifically versions before Feb 2024), has a preference on running
/bin/ps./bin/psis a setuid binary.The macOS
sandbox-execsecurity policy correctly and strictly blocks setuid binaries to prevent privilege escalation.Newer versions of Homebrew use
lsofand thus users with an updated version of Homebrew don't experience this issue.(@testyour - this is what we see in your case -
/opt/homebrew/Library/Homebrew/cmd/shellenv.sh: line 18: /bin/ps: Operation not permitted, line 18 has/bin/psonly in older versions of Homebrew.)/bin/psto detect the shell.lsof.When users have the older version,
brew shellenvinvokes/bin/ps.Shell initialization fails mid-way and prints
Operation not permittederrors becausepsis blocked. While the shell might not crash entirely, the environment (specificallyPATH) is often not set up correctly, leading to "command not found" errors for tools likenpm,git, orpython, alongside the confusing permission error noise.This behavior is expected to happen by default for all Mac users with Homebrew installations older than Feb 2024.
@zzhang1 mentioned it also happens for him on Ubuntu, which I didn't investigate.
@etraut-openai - We can disable the forced login shell and it would solve the issue - but it would defeats the purpose of the feature. (Change ShellCommandHandler::base_command to default
use_login_shelltofalseinstead oftrue).But considering the community attention - I think it might be best to consider a cmdline flag to set
use_login_shell=falseand to prompt it when we detect this issue.WDYT?
@Bronx83 appreciate you starting to dig in here. However, shell snapshots run _outside_ the sandbox, so they should, in theory, be a strict improvement here. Can you try reproducing this issue on 0.71.0?
@dylan-hurd-oai
You are absolutely correct that shell snapshots are intended to capture the environment so commands can run as non-login shells. However, although it bypasses Seatbelt sandbox, it does not bypass MacOS-Application-Sandbox.
The
shell_snapshotfeature introduced two components:use_login_shell = true). This change was applied globally in https://github.com/openai/codex/blob/a2c86e5d8830006cb30c9367d70f4f84ef3bb6cc/codex-rs/core/src/tools/handlers/shell.rs#L47 Regardless of whether the snapshot feature is enabled or disabled.While snapshots bypass the Codex-imposed Seatbelt sandbox (applied via
sandbox-exec), they cannot escape the OS-level App Sandbox that the main Codex process runs in. Any child process spawned by Codex inherits this OS sandbox.Flow when
shell_snapshotis DISABLED (Default):https://github.com/openai/codex/blob/a2c86e5d8830006cb30c9367d70f4f84ef3bb6cc/codex-rs/core/src/features.rs#L360
zsh -lc) inside the sandbox..zprofile, which runsbrew shellenv--(which on older installs runs)-->pspsFlow when
shell_snapshotis ENABLEDzsh -lc) to capture the environment.brew shellenvrunsps, which is blocked by the App Sandbox.To reproduce on modern Homebrew version:
~/.zprofile<img width="1510" height="695" alt="Image" src="https://github.com/user-attachments/assets/36fec63c-0d80-4bb1-8db0-7c315ea39eed" />
To put it simply:
ps).psin theirshellenvscript (called by.zprofile).-lc). This forces.zprofileto run for every command, exposing this crash to everyone with that setup.Enabling
shell_snapshotdoesn't fix it because the snapshot creation process itself runs a login shell inside the sandbox, so it hits the same crash, fails, and falls back to the broken default behavior.I am happy to discuss this over Zoom if needed.
Shell initialization warning causes unnecessary token consumption in automated/programmatic usage
I'm building thinkon (a thinking orchestration framework) that uses Codex CLI as an executor via
codex exec --json --full-auto.The recurring
/bin/ps: Operation not permittedwarning from Homebrew'sshellenv.shcauses significant issues in programmatic usage:Impact
``
json
``{"type":"reasoning","text":"**Noting permission error but continuing**\n\nThe shell output shows a permission error..."}
``
``Hello, Thinkon Do!/opt/homebrew/Library/Homebrew/cmd/shellenv.sh: line 18: /bin/ps: Operation not permitted
Token consumption evidence
For a trivial task (create a single text file):
Reproduction
Environment
/opt/homebrew.zprofileRoot cause
Codex uses
/bin/zsh -lc(login shell) for command execution, which loads full shell initialization including Homebrew'sshellenv.sh. The sandbox blocks/bin/pswhichshellenv.shcalls.Suggested solutions
/bin/zsh -c) when possible, or provide an option to disable login shell.zprofileworkaroundWorkaround (user-side)
Modify
~/.zprofile:But this workaround requires users to modify their system config, which breaks the expectation that "any machine with working Codex should just work."
@lexobe, you might want to try the experimental "shell snapshot" feature. Use the
/experimentalslash command to enable it.This bug report has received no upvotes or new posts in over two months. We are still tracking other bug reports related to permission errors, but I think this one has been addressed, so I'm going to close it.