Git always got `Operation not permitted` error when using `/review` command
Resolved 💬 4 comments Opened Dec 15, 2025 by keliwang Closed Dec 17, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
0.72.0
What subscription do you have?
ChatGPT plus
Which model were you using?
gpt-5.2
What platform is your computer?
Darwin 24.6.0 arm64 arm
What issue are you seeing?
When using codex's internal /review command, got some git errors:
git: warning: confstr() failed with code 5: couldn't get path of DARWIN_USER_TEMP_DIR; using /tmp instead
git: error: couldn't create cache file '/tmp/xcrun_db-pQ8MrjTj' (errno=Operation not permitted)
What steps can reproduce the bug?
Uploaded thread: 019b1fd6-b5b7-7620-bc3a-5856b7dbc0d1
What is the expected behavior?
_No response_
Additional information
_No response_
4 Comments
I would like to solve this issue
To make /review work on macOS without Git errors, you can configure the environment so Git has access to temporary files and cache. Step by step:
⸻
mkdir -p $HOME/tmp
export TMPDIR=$HOME/tmp
export TEMP=$HOME/tmp
export TMP=$HOME/tmp
This redirects all temporary files for Git (and commands run via /review) to your directory.
chmod 700 $HOME/tmp
It’s important that the environment variables are set before running /review, for example:
/tmp/codex-review-thread # or however your command is invoked
So you don’t have to do it every time:
export TMPDIR=$HOME/tmp
export TEMP=$HOME/tmp
export TMP=$HOME/tmp
This fixes both issues: Git no longer tries to write to /tmp, and the Operation not permitted error disappears.
Even with the
--dangerously-bypass-approvals-and-sandboxoption, I still encounter this permission issue.This will be addressed in the next release. Refer to this PR for details.