Where Does the Codex CLI Store Config and Sessions?
Where the Codex CLI keeps config.toml, login credentials, and session transcripts on macOS, Linux, and Windows.
Last updated
The Codex CLI keeps almost everything in one hidden folder in your home directory: .codex. The main settings file is config.toml at its root, login state sits in auth.json beside it, and past session transcripts accumulate in a sessions subdirectory.
That layout is the same on macOS, Linux, and Windows, only the home directory prefix differs. Backing up or resetting the tool usually means copying or deleting this one folder rather than hunting through the system. If the folder goes missing, the CLI recreates it on next launch, which also clears most login glitches.
Where Codex CLI stores this, by platform
~/.codex
config.toml is the file to edit for model and approval settings. auth.json holds the ChatGPT sign in token, so copy it with care. Session transcripts live in sessions/ and can grow large over months of use.
~/.codex
Identical layout to macOS: config.toml for settings, auth.json for login, sessions/ for transcripts. A per project file named config.toml in the repo root can override some of these values for that project only.
%USERPROFILE%\.codex
Same three files under your user profile. Paste %USERPROFILE%\.codex into the Explorer address bar to jump there. The npm and installer builds share this location, so switching install methods keeps your login.
Frequently asked questions
where is the codex cli config file
Open ~/.codex/config.toml in a text editor. It holds the model, approval mode, and provider settings. Changes apply to the next session you start, since a running session keeps its launch time config.
how do i clear codex cli session history
Delete the sessions subdirectory inside ~/.codex (or %USERPROFILE%\.codex on Windows). That clears stored transcripts without touching your login or config.toml. Quit the CLI first so it does not rewrite a file mid deletion.
where does codex cli store my login
In auth.json inside the same .codex directory. It holds the token from Sign in with ChatGPT or your API key reference. Treat it like a password: anyone with that file can bill your account.
Notice an outdated path? Let us know.