Clear Codex cache and logs on Mac

Codex CLI, OpenAI coding agents, and related tools write caches and verbose logs under ~/Library and ~/.cache. This guide covers safe cleanup on macOS 14+ and grouped removal via AI Agent Clean.

Get free trial

AI Agent Clean Team · Updated 2026-07-24 · macOS 14+

Codex and adjacent OpenAI developer tooling have moved quickly from CLI experiments to daily workflow utilities. Each run can append logs, store intermediate artifacts, and cache model responses or embeddings locally. Unlike a single .app bundle, Codex-related data may sprawl across Application Support, Caches, hidden dot-folders in your home directory, and project-adjacent temp directories.

Clearing Codex caches is generally low risk when you target logs, tmp folders, and regenerable cache stores — not your actual project source or .env secrets. After cleanup, the next Codex invocation may take longer while caches rebuild. Always stop active Codex processes before deleting open files.

Typical Codex-related locations on Mac

  • ~/Library/Application Support/Codex/ or OpenAI-branded folders — app state and local databases.
  • ~/Library/Logs/ — agent and CLI log files, sometimes rotated but often unbounded.
  • ~/.cache/ — CLI tools frequently mirror Linux conventions here on macOS.
  • /tmp and $TMPDIR — short-lived build artifacts (cleared on reboot, but can grow within a session).
  • Open Design and related IDE integrations — may share cache patterns with other AI dev tools scanned by AI Agent Clean.

Step-by-step manual cleanup

  1. Stop Codex processes — quit IDE integrations, terminate codex or related CLI in Terminal (pkill -f codex only if you know what you are stopping).
  2. Archive logs if needed — copy ~/Library/Logs Codex-related files to ~/Desktop/Codex-logs-backup before deletion if you need them for debugging.
  3. Remove log files — delete *.log and rotated logs inside Codex-specific log folders.
  4. Clear Application Support caches — inside Codex support folders, remove Cache, tmp, and GPUCache subdirectories.
  5. Check ~/.cache — remove openai- or codex-named cache trees after confirming no active session.
  6. Verify in Terminal — run your usual Codex command; first run may regenerate caches.

AI Agent Clean workflow

AI Agent Clean groups Codex with Cursor and Claude under AI Agent Clean. The scan labels data types — indexes, logs, crash reports, update debris — so you do not guess folder names.

  1. Grant Full Disk Access if prompted (macOS 14+).
  2. Run AI Agent Clean or full Smart Scan from the Mac cleaner module.
  3. Expand Codex and Open Design groups; uncheck anything you need for an active sprint.
  4. Clean to Trash; restore from Trash if a tool misbehaves after relaunch.
Safety warnings
  • Never delete .env, API key files, or project directories while hunting caches.
  • Some SQLite files mix cache and session state — prefer category-based cleanup over blind folder delete.
  • Logs may contain file paths from your machine; treat archived logs as sensitive.
  • Do not use sudo rm -rf on Library paths — user-level Trash is sufficient.
  • Review symlink targets before bulk delete; AI Agent Clean re-checks symlinks before removal.

macOS 14+ and Apple Silicon notes

On Apple Silicon Macs, Rosetta-translated CLI binaries may create duplicate cache trees. After major macOS upgrades, stale Codex folders from older OS versions sometimes remain — sort Application Support by size to find them. macOS 14’s stricter privacy prompts mean your terminal may not see all Library paths without Full Disk Access when using third-party scanners.

How much space can you recover?

Light CLI users might recover hundreds of megabytes; heavy agent users with verbose logging can reclaim 5–20 GB. Pair Codex cleanup with finding disk space on Mac using Space Lens to see neighboring large folders like Docker or Xcode.

Automating log rotation

Developers who run Codex agents daily should adopt a simple rotation habit: monthly archive of logs to external storage, then cleanup of local copies. AI Agent Clean’s log category labels make this faster than writing custom find scripts. For CI machines, consider separate user accounts so agent logs do not mix with personal Library data.

On macOS 14+, unified logging also stores metadata outside ~/Library/Logs — AI Agent Clean focuses on user-writable agent paths, not system diag bundles that require root access.

Project-level temp files

Some Codex workflows write temp artifacts inside project directories (for example .codex/ or node_modules/.cache). AI Agent Clean focuses on Library paths; use Large & Old Files or Space Lens on project roots for repo-local bloat. Never delete .git or lockfiles when chasing temp caches.

Related resources

Get your free trial

Open the Mac App Store to install AI Agent Clean. Install to start your trial — no email required.

Get free trial