codex icon indicating copy to clipboard operation
codex copied to clipboard

Git always got `Operation not permitted` error when using `/review` command

Open keliwang opened this issue 4 weeks ago • 2 comments

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

keliwang avatar Dec 15 '25 02:12 keliwang

I would like to solve this issue

aviralgarg05 avatar Dec 15 '25 10:12 aviralgarg05

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:

  1. Create your own temporary directory

mkdir -p $HOME/tmp

  1. 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.

  1. Check directory permissions

chmod 700 $HOME/tmp

  1. 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

  1. (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

keliwang avatar Dec 17 '25 03:12 keliwang

This will be addressed in the next release. Refer to this PR for details.

etraut-openai avatar Dec 17 '25 06:12 etraut-openai