Change the hardcoded $HOME/.codex path

Resolved 💬 6 comments Opened Sep 28, 2025 by qodeninja Closed Dec 31, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.41.0

Which model were you using?

latet 5

What platform is your computer?

linux

What steps can reproduce the bug?

Install codex. Use it.

Home directory is polluted with codex garbage.

What is the expected behavior?

Codex should respect XDG directories and be a good visitor on a host system and not pollute the $HOME directory with clutter.

What do you see instead?

Codex creating noise in my $HOME directory. Codex is not a first-class guest on my system and is not allowed to write where it wants to. It should respect User system and preferences and not be a bull in a china shop. Default paths should be user configurable, or use standard XDG/Linux directories like ~/.config ~/.local/ or */etc

Additional information

_No response_

View original on GitHub ↗

6 Comments

dennisvink · 11 months ago

You can set CODEX_HOME to whatever you want.

kulesh · 10 months ago

If we can set the default value of CODEX_HOME=$XDG_CONFIG_HOME/codex, I don't have to setup a home directory for every tool I have in the tool chain.

https://github.com/openai/codex/blob/44ceaf085b0ffafe127a050fd5d35797b8ab1fc9/codex-rs/core/src/config.rs#L1445

kulesh · 10 months ago

Will something like this work? https://github.com/kulesh/codex/commit/d1fb6e2f5d6663ee4836fd7f805840e9137d6139

(When CODEX_HOME is present just use that; otherwise follow XDG spec when XDG_CONFIG_HOME is set before falling back to default?)

etraut-openai contributor · 7 months ago

As noted above, codex supports the CODEX_HOME env var.

bartekpacia · 6 months ago

Please consider reopening this issue.

Why have us manually set CODEX_HOME when you can just follow existing established conventions like the XDG base dir spec?

If every CLI tool had this approach, our bashrc/zshrc files would be full of X_HOME=..., Y_HOME=.... etc.

be nice

etraut-openai contributor · 6 months ago

@bartekpacia, see feature request https://github.com/openai/codex/issues/1980. Feel free to upvote that.