The Codex CLI was using 4.4 GB, and 1.9 GB was an install that never finished
OpenAI's Codex CLI keeps runtimes in ~/.cache and sessions in ~/.codex. Measured at 4.4 GB, including an abandoned 1.9 GB install staging folder.
AI coding agents that run in the terminal are not a single binary. The Codex CLI downloads its own runtime, keeps every session transcript, and installs plugins and packages alongside, in two hidden folders in your home directory.
Where it went
| Folder | Size | What it is |
|---|---|---|
~/.cache/codex-runtimes/codex-runtime-install-j4scDL | 1.88 GB | A staging folder from 3 August |
~/.cache/codex-runtimes/codex-primary-runtime | 1.57 GB | The runtime actually in use, written 6 August |
~/.codex/packages | 310 MB | Downloaded packages |
~/.codex/plugins | 297 MB | Installed plugins |
~/.codex/sessions | 115 MB | Your conversation history |
~/.codex/logs_2.sqlite | 66 MB | Logs |
~/.codex/computer-use | 63 MB | Computer use support files |
The first row is the interesting one. A folder named ...-install- followed by random characters is how installers stage a download before moving it into place. This one is older than the working runtime and larger than it, which is what an install that was interrupted and then retried looks like. Nothing reads it.
Check yours
du -sh ~/.cache/codex-runtimes/* ~/.codex/* 2>/dev/null | sort -h
ls -la ~/.cache/codex-runtimes/What is safe to remove
| What | Safe? | Note |
|---|---|---|
codex-runtime-install-* staging folders | Yes | Leftovers from an install; the working runtime is separate |
logs_2.sqlite | Yes | Recreated |
Old months in sessions | Yes, if you do not resume them | Sessions are organised by year, then month |
codex-primary-runtime | It comes back | Removing it forces a fresh download next launch |
plugins, packages | Only if you remove the plugin too | Otherwise they are downloaded again |
Other agents keep their files in similar places and make the same kind of mess: Claude Code keeps a folder per version. The editors built around them are in AI coding tools taking up space.
Common questions
Where does the Codex CLI store its files on a Mac?
In two hidden folders: ~/.cache/codex-runtimes for the runtime it downloads, and ~/.codex for sessions, plugins, packages and logs.
What is the codex-runtime-install folder?
A staging folder an install writes to before moving into place. One left behind next to a working codex-primary-runtime is a leftover and can be removed.
Is it safe to delete ~/.codex/sessions?
Yes, if you do not need to resume old conversations. It is your history, not something the CLI needs to run.
How much space does the Codex CLI use?
On the Mac measured, 4.4 GB in total. 1.9 GB of that was an abandoned install folder.