Codex temporary Rust build artifacts in /private/tmp consumed ~79GB and persisted

Resolved 💬 0 comments Opened Jul 6, 2026 by chenjinsasasa Closed Jul 7, 2026

Summary

Codex-related temporary Rust build artifacts under /private/tmp consumed about 79 GB on macOS and persisted after the build/session, causing macOS "System Data" to spike and the internal disk to drop from about 79 GiB free to 15 GiB free.

Environment

  • Product: Codex / Codex Desktop local environment
  • macOS: 26.5.2, build 25F84
  • Arch: arm64
  • Global npm package: @openai/codex@0.118.0
  • codex --version result after the incident: fails with ENOENT for missing vendor binary at @openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex/codex. This may or may not be related.

Observed disk impact

Before cleanup:

Filesystem        Size    Used   Avail Capacity Mounted on
/dev/disk3s1s1   228Gi    12Gi    15Gi    44%   /
/dev/disk3s5     228Gi   185Gi    15Gi    93%   /System/Volumes/Data

Large directories found under /private/tmp:

/private/tmp/codex-p2g-target                         45G
/private/tmp/codex-p2m-target                         32G
/private/tmp/codex-p2g-cargo-home                    2.1G
/private/tmp/codex-runtime-source-rust-v0.142.5-p2g  71M
/private/tmp total                                    78G

The two target directories contained Rust debug build outputs, including large debug/codex binaries around 591 MB each.

No active cargo, rustc, or /private/tmp/codex-p2* process was using the directories when inspected.

Cleanup result

After deleting only the exact temporary Codex build directories and thinning the local Time Machine snapshot:

rm -rf /private/tmp/codex-p2g-target \
       /private/tmp/codex-p2m-target \
       /private/tmp/codex-p2g-cargo-home \
       /private/tmp/codex-runtime-source-rust-v0.142.5-p2g.7ChyEh

tmutil thinlocalsnapshots / 80000000000 4

Disk space recovered:

Filesystem        Size    Used   Avail Capacity Mounted on
/dev/disk3s1s1   228Gi    12Gi    96Gi    11%   /
/dev/disk3s5     228Gi   104Gi    96Gi    53%   /System/Volumes/Data

/private/tmp then dropped to about 16 MB.

Expected behavior

Codex temporary Rust build directories under /private/tmp should either be bounded, reused safely, placed in a documented cache location, or removed automatically after the build/session. A failed or repeated build should not leave tens of GB of target/debug artifacts in /private/tmp without cleanup.

Actual behavior

Temporary build directories named codex-p2g-target and codex-p2m-target persisted and together consumed about 77 GB. macOS reported this as "System Data", creating a low-disk-space condition.

Request

Please consider adding automatic cleanup or size limits for these Codex temporary Rust build directories, and optionally a startup/exit sweep for stale /private/tmp/codex-p2*-target and related codex-p2*-cargo-home directories when no active Codex build process owns them.

View original on GitHub ↗