feat: allow sandbox to read/write some files/directories anywhere on the machine

Resolved 💬 7 comments Opened Apr 18, 2025 by jdemeulenaere Closed Aug 7, 2025
💡 Likely answer: A maintainer (fouad-openai, contributor) responded on this thread — see the highlighted reply below.

The sandboxed mode currently fails to run gradle commands because it is not allowed to read the ~/.cache/ directory:

    xargs: sysconf(_SC_ARG_MAX) failed
    Exception in thread "main" java.io.FileNotFoundException:
    /Users/jdemeulenaere/.gradle/wrapper/dists/gradle-8.11.1-bin/bpt9gzteqjrbo1mjrsomdt32c/gradle-8.11.1-bin.zip.lck (Operation not permitted)
    	at java.base/java.io.RandomAccessFile.open0(Native Method)
    	at java.base/java.io.RandomAccessFile.open(RandomAccessFile.java:366)
    ... (7 more lines)

It would be nice if we could give read or write access to some files when in sandboxed mode on macOS.

View original on GitHub ↗

7 Comments

fouad-openai contributor · 1 year ago

agreed! we should expand the list of "common roots" that are allowed for auto-approval.

codex-maintainers · 11 months ago

Thank you for the feedback! Please try the latest version of Codex CLI, as we're actively addressing issues and improving the sandboxing capabilities. If the issue persists, feel free to let us know.

paperbenni · 10 months ago

This persists. I cannot modify ~/.cache

esafak · 9 months ago

I can't make codex use gradle.

viktor-shymko-hebron · 9 months ago

The issue persists for me as well

edoardo-bluframe · 9 months ago

Same here you guys! Cypress write cache in ~/.cache/Cypress and we can't write to it from our codebase sandbox!

A list of directories in config.toml that allows to write would really work!

[sandbox_workspace_write]
external_directories = [ "~/.cache", "~/.local" ]

Are you guys able to implement that?

0xdevalias · 8 months ago
A list of directories in config.toml that allows to write would really work!
Are you guys able to implement that?

Since v0.48.0:

And then not sure exactly what version from, but maybe similar or earlier(?):

# Extra settings that only apply when `sandbox = "workspace-write"`.
[sandbox_workspace_write]
# ..snip..
# Optional list of _additional_ writable roots beyond $TMPDIR and /tmp.
writable_roots = ["/Users/YOU/.pyenv/shims"]

Edit: Seemingly writable_roots has been around for quite a while. Docs were added August 20th, which implies the feature may have existed even earlier than that:

Edit 2: It looks like writable_roots may have been first introduced in the following PR back on June 25th: