What is ~/.codex on a Mac, and what can I delete?

My ~/.codex folder was 5.7 GB. Half of it was sessions I'll never open again.

Shiva ChandraMaker of Clean House · · 2 min read
Short answer

~/.codex is where OpenAI's Codex keeps your sessions, a history database, generated images, logs and a cache. Mine was 5.7 GB. Sessions were 3.1 GB and the history database 1.4 GB. The cache and logs are safe to clear, old sessions are fine if you won't resume them, and you should keep your config.

Path
~/.codex
What it is
Codex sessions, history, generated images, logs and cache
Size on my Mac
5.7 GB (measured 25 November 2026)
Made by
Codex (OpenAI)
Safe to delete?
Look first
Comes back?
The cache rebuilds. Sessions, history and images don't

The breakdown on my Mac

ItemSizeWhat it isVerdict
sessions3.1 GBOne file per sessionLook first
thread_history_1.sqlite1.4 GBHistory of your threadsKeep
generated_images601 MBImages Codex madeLook first
cache120 MBCacheSafe to clear
logs_2.sqlite83 MBLogsSafe to clear

What I'd delete and what I'd keep

Cache and logs, delete whenever. Old sessions, fine if you're not going back to them. Images are gone for good once deleted, so save the good ones first. Don't wipe the whole folder: your config and sign-in are in there too.

How to clean it

  1. See what's big: du -sh ~/.codex/* | sort -h
  2. Quit Codex.
  3. Move old folders out of ~/.codex/sessions to the Trash.
  4. Save the images you want from generated_images, then trash the rest.

Keeping it small

Every run gets saved, even the two-minute ones, so sessions pile up fast. Once a month I sort the folder by date and trash anything older than a few weeks. Leave the history database alone. Codex reads it to show your past work.

What Clean House does with it

Clean House shows each part of ~/.codex with its own verdict, so the cache shows as safe and sessions show as Look first. Nothing gets deleted outright. It all goes to the Trash.

Clean House review screen where each item says whether it rebuilds, downloads again or never comes back
Before anything moves, each item says whether it comes back.

Questions

Why is my .codex folder so big?

Sessions and history. Mine was 5.7 GB: 3.1 GB of sessions, a 1.4 GB history database and 601 MB of generated images.

Is it safe to delete ~/.codex/sessions?

Old ones, yes, if you won't resume them. Keep the rest of the folder. Your config and sign-in live there.

Can I delete generated_images in .codex?

Yes, once you've saved the ones you want somewhere else. They don't come back.

Sources

  1. OpenAI Codex on GitHub