Skip to content

git fails to access tmp directory #191

Closed

Description

@steipete

Is there a way to fix these? I assume this is sandboxing in effect, it makes some git operations to fail.

$ git ls-files -i --exclude-standard

    command.stdout (code: 128, duration: 0s)

    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-Q5a5z5VJ' (errno=Operation not permitted)
    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-EIrGD0DV' (errno=Operation not permitted)
    ... (2 more lines)

    thinking for 17s

Activity

  1. jonchurch commented on Apr 19, 2025

    @jonchurch
    Contributor

    Related to #207

    Im hoping it would be addressed by something like #378 but this is a new path, not /var/tmp...

    can you install version 0.1.2504172351 ala npm i @openai/[email protected] and see if it reproduces?
    Well that build does have a crash, so first make sure you do

    mkdir -p ~/.pyenv then run codex

    if that version doesnt work, can you pass in /tmp as a writeable root to codex?
    codex -w /tmp

    You are correct it is sandboxing, which you can see the policies here:

    export function execWithSeatbelt(

  2. lukemauldinks commented on May 16, 2025

    @lukemauldinks

    I am using codex 0.1.2505140839 on OSX and I am getting the same error even when using codex -w /tmp.
    It is 100% repeatable when doing a git commit.
    Is there a solution for this yet? Let me know if you need more logs or for me to try other steps.

  3. kalifg commented on May 20, 2025

    @kalifg

    I just installed codex yesterday and I'm having the same issue

  4. Damecek commented on May 21, 2025

    @Damecek

    same issue here

       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-SjDk74mv' (errno=Operation not permitted)
        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-y2HLPe7e' (errno=Operation not permitted)
    

    macos 15.4.1 (24E263)

  5. Damecek commented on May 21, 2025

    @Damecek

    updated to v0.1.2505172129 and looks like error is gone

        $ git add src/content_scripts/modules/x/commandPallet/commandPallet.js backlog.md && git commit -m "feat(command-palette): focus input field when palette
         opens"
    
        command.stdout (code: 0, duration: 1.6s)
    
        [feature/command-mvp d0634c6] feat(command-palette): focus input field when palette opens
         3 files changed, 18 insertions(+), 1 deletion(-)
         create mode 100644 .DS_Store
    
  6. lukemauldinks commented on May 21, 2025

    @lukemauldinks

    I am still getting an error on the latest version when I launch codex with --approval-mode=full-auto (see the error below). But strangely enough it works as expected if I do not set the approval mode and just manually approve the command.

    user
    commit the change to the go.mod file to git
    
        command
    
        $ git add go.mod && git commit -m "Update go directive to v1.24.2 in go.mod"
    
        command.stdout (code: 128, duration: 0.1s)
    
        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-MEmYhXZD' (errno=Operation not permitted)
        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-rOPeCCsT' (errno=Operation not permitted)
        ... (7 more lines)
    
        command
    
        $ export TMPDIR=$(pwd) && git add go.mod && git commit -m "Update go directive to v1.24.2 in go.mod"
    
        command.stdout (code: 128, duration: 0.1s)
    
        error: No user exists for uid 501?
    
        fatal: failed to write commit object
    
  7. Damecek commented on May 23, 2025

    @Damecek

    managed to capture fail and success in single thread

      $ git add src/background/messageListener.js && git commit -m "fix(messageListener): handle unknown actions and catch errors"
    
        command.stdout (code: 1, duration: 71s)
    
        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-bjY9w2vm' (errno=Operation not permitted)
        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-FRcxIDMS' (errno=Operation not permitted)
        ... (17 more lines)
    
        command
    
        $ git add src/background/messageListener.js && git commit --no-verify -m "fix(messageListener): handle unknown actions and catch errors"
    
        command.stdout (code: 0, duration: 0.1s)
    
        [main 74c6789] fix(messageListener): handle unknown actions and catch errors
         1 file changed, 9 insertions(+), 1 deletion(-)
    

    looks like when --no-verify flag is used, the error won't trigger

  8. westito commented on May 29, 2025

    @westito

    Same here. Because there is no way to disable sandbox, I solved this by clone this repo and eliminated sandbox in handle-exec-command.ts. Then installed this local package. Works like a charm.

    async function getSandbox(runInSandbox: boolean): Promise<SandboxType> {
      return SandboxType.NONE;
    }
  9. Damecek commented on Jun 17, 2025

    @Damecek

    this has been fixed for me, on version codex-cli 0.0.2505291458

  10. codex-maintainers commented on Aug 7, 2025

    @codex-maintainers

    Thank you for the feedback! Please try again on the latest version of Codex CLI, as we've been addressing sandboxing and related issues. If the problem persists, feel free to reach out again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions