Git always got `Operation not permitted` error when using `/review` command
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
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:
⸻
- Create your own temporary directory
mkdir -p $HOME/tmp
- Tell Git to use this directory
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.
- Check directory permissions
chmod 700 $HOME/tmp
- Run /review from this terminal
It’s important that the environment variables are set before running /review, for example:
/tmp/codex-review-thread # or however your command is invoked
- (Optional) Add to .zshrc or .bashrc
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-sandbox option, I still encounter this permission issue.
└ 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-hr05Eiqi' (errno=Operation not permitted)
… +7 lines
instead.
fatal: unable to create temp-file: Operation not permitted
This will be addressed in the next release. Refer to this PR for details.