bug: No such file or directory

Resolved 💬 3 comments Opened Apr 16, 2025 by jayshrivastava Closed Aug 7, 2025

I'm getting this bug on Macos 15.2. The program is unable to edit files. It's likely a permissions issue.

export OPENAI_API_KEY=XXXXX && codex -m gpt-4o --full-auto
    command

    $ ls

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

    CONTRIBUTING.md
    LICENSE.md
    README.md
    app
    ... (18 more lines)

    codex
    The directory contains the following files and folders:

        * `CONTRIBUTING.md`
        * `LICENSE.md`
        * `README.md`

(truncated)

    If you need to modify or access any specific files, feel free to let me know!
user
add any line to README.md

    codex
    Let's add a comment line to the README.md. I'll proceed with that.

    command

    $ "echo '
    <\!-- This is a sample comment added for demonstration purposes. -->
    ' >> README.md"

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

    sandbox-exec: execvp() of 'echo '
    <!-- This is a sample comment added for demonstration purposes. -->
    ' >> README.md' failed: No such file or directory


    codex
    I encountered an issue with the execution environment. Let's modify the README.md directly using a patch.

    command

    $ 'cat README.md'

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

    sandbox-exec: execvp() of 'cat README.md' failed: No such file or directory


    codex
    It seems there's a consistent error accessing the file. Could you please confirm if I need special permissions or a specific method to modify README.md in this environment?

View original on GitHub ↗

3 Comments

Abhijrathod · 1 year ago

Open System Settings and select Privacy & Security > Full Disk Access.

Click the Add button and select your preferred terminal app.

To ensure that the changed permissions are applied, restart your terminal.

Now, if you're still encountering roadblocks, let's troubleshoot like experts:
SIP might be acting as a gatekeeper. If you try to access files in protected locations such as /System or /Applications, System Integrity Protection (SIP) will prohibit you. To avoid the drama, stick to your home folder (~/Documents, ~/Desktop).

Sandbox issues? If you’re on a local dev machine and you’re sure it’s safe, you can temporarily disable the sandbox for testing (but don’t make this a habit, it’s like leaving your front door unlocked):
bash

sudo spctl --master-disable

Or if you’re running codex in a script, try bypassing the sandbox entirely:

/usr/bin/env codex ...

Check your codex setup. If it’s acting funky, it might be sandboxed or calling the shell wrong (especially if you installed it with some janky script). Test if your system’s cool by running:

echo "Test line" >> README.md

MovGP0 · 1 year ago

I encountered a similar issue where I gave codex the full path to a file and it was unable to find the file.

Windows 11
PowerShell

codex-maintainers · 1 year ago

Thank you for the feedback! Please try again with the latest version of Codex CLI. If the issue persists, feel free to let us know.