Codex fails to create `xcrun`'s cache in the sandbox

Open 💬 0 comments Opened Jun 3, 2026 by fluiderson

What version of Codex CLI is running?

codex-cli 0.136.0

What subscription do you have?

Enterprise

Which model were you using?

gpt-5.5

What platform is your computer?

Darwin 25.5.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

Cursor 3.6.21

Codex doctor report

{
  "schemaVersion": 1,
  "overallStatus": "ok",
  "codexVersion": "0.136.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "mode": "ephemeral",
        "status": "not running"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "config.toml parse": "ok",
        "enabled feature flags": "shell_tool, unified_exec, shell_snapshot, terminal_resize_reflow, sqlite, hooks, enable_request_compression, multi_agent, apps, tool_suggest, plugins, in_app_browser, browser_use, browser_use_external, computer_use, plugin_sharing, image_generation, skill_mcp_dependency_install, steer, guardian_approval, goals, collaboration_modes, tool_call_mcp_elicitation, personality, fast_mode, tui_app_server, workspace_dependencies",
        "feature flag overrides": "none",
        "feature flags enabled": "27",
        "model": "<default>",
        "model provider": "openai"
      },
      "remediation": null,
      "durationMs": 0
    },
    "git.environment": {
      "id": "git.environment",
      "category": "git",
      "status": "ok",
      "summary": "git version 2.54.0",
      "details": {
        ".git entry": "directory",
        "git version": "git version 2.54.0",
        "repo detected": "true",
        "selected git": "/opt/homebrew/bin/git"
      },
      "remediation": null,
      "durationMs": 7
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "install context": "brew",
        "managed by bun": "false",
        "managed by npm": "false"
      },
      "remediation": null,
      "durationMs": 2
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {},
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "details": {},
      "remediation": null,
      "durationMs": 136
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket handshake succeeded",
      "details": {
        "connect timeout": "15000 ms",
        "handshake result": "HTTP 101 Switching Protocols",
        "model provider": "openai",
        "provider name": "OpenAI",
        "reasoning header": "false",
        "server model present": "false",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 796
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running brew on macos-aarch64",
      "details": {
        "install method": "brew",
        "platform": "macos-aarch64",
        "version": "0.136.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (system)",
      "details": {
        "search command": "rg",
        "search command readiness": "ripgrep 15.1.0",
        "search provider": "system"
      },
      "remediation": null,
      "durationMs": 2
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "OnRequest",
        "codex-linux-sandbox helper": "none",
        "filesystem sandbox": "restricted",
        "network sandbox": "restricted"
      },
      "remediation": null,
      "durationMs": 0
    },
    "system.environment": {
      "id": "system.environment",
      "category": "system",
      "status": "ok",
      "summary": "OS language en-US",
      "details": {
        "LANG": "en_US.UTF-8",
        "os": "Mac OS 26.5.1 [64-bit]",
        "os language": "en-US",
        "os type": "Mac OS",
        "os version": "26.5.1"
      },
      "remediation": null,
      "durationMs": 2
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "COLORTERM": "truecolor",
        "TERM_PROGRAM": "vscode",
        "VSCODE_INJECTION": "present",
        "color output": "disabled (stdout is not a terminal)",
        "effective locale": "en_US.UTF-8",
        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout is terminal": "false",
        "terminal": "VS Code",
        "terminal size": "155x37",
        "terminal version": "3.6.21"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.136.0",
        "check for update on startup": "true",
        "latest version": "0.136.0",
        "latest version status": "current version is not older",
        "update action": "brew upgrade --cask codex"
      },
      "remediation": null,
      "durationMs": 1179
    }
  }
}

What issue are you seeing?

When I'm trying to make a linked artifact (e.g., an executable) with Rust, it reports

warning: output of `xcrun` while finding MacOSX.sdk
  |
  = note: xcrun: error: couldn't create cache file (errno=Operation not permitted)
          xcrun: error: couldn't create cache file (errno=Operation not permitted)

As I understand, on macOS, Rust tries to execute xcrun --sdk macosx --show-sdk-path that attempts to write its cache file outside of the sandbox.

What steps can reproduce the bug?

Ask Codex to run echo 'fn main() {}' | rustc -; rm rust_out.

Or ask it to run xcrun --sdk macosx --show-sdk-path.

What is the expected behavior?

No xcrun: error: couldn't create cache file errors.

Additional information

rustc 1.96.0 (ac68faa20 2026-05-25)

View original on GitHub ↗