Implement XDG_CONFIG_HOME for ~/.claude.json
Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Workaround ✓ Mentioned in thread ↓
Activity 6 comments · opened Mar 2, 2025 · closed Mar 2, 2025
💡 Likely answer: A maintainer (bcherny, collaborator)
responded on this thread — see the highlighted reply below.
Currently it seems there's no way to change where the .claude.json lives. It would be great if it could be loaded from $XDG_CONFIG_HOME/claude/claude.json according to the XDG Base Directory Specification
6 Comments
You can do this with the
CLAUDE_CONFIG_DIRenv var. Beware this API isn't finalized and may change.@bcherny Its great that you provide
CLAUDE_CONFIG_DIRto change the location, but by not usingXDG_CONFIG_HOMEby default you are not following the desktop standard. This causes problems on Linux workstations.@bcherny even after having
CLAUDE_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/claude"variable set up in my system, Claude still creates.claude/statsig/folder in my $HOME@bcherny you can't be serious that you close an issue with a valid concern; It doesn't follow XDG Base Directory Specification as said above. This makes everyone that changes
XDG_CONFIG_HOMEpretty unhappy with what you're serving them, you don't even recognize it as an issue?https://github.com/anthropics/claude-code/blob/555b6b5b8a5f06f1e8725a584e62fb6b7c8eece5/README.md?plain=1#L44
Welcome or not welcome?
@bcherny Thanks for pointing out the
CLAUDE_CONFIG_DIRworkaround, but I respectfully believe this issue warrants reopening. Relying on a custom environment variable alone doesn’t mesh with the wider Linux ecosystem’s expectations, and as others have noted, it doesn’t always work in practice.According to the XDG Base Directory Specification, applications should default to loading config from
when no override is provided.
This "just works" for users who have already set
XDG_CONFIG_HOME, it follows established desktop standards, avoiding surprise files as mentioned by @SamDc73. This would eliminate friction for Linux users who expect applications to respect the XDG spec by default....I urge you to consider reopening this ticket and updating the loader to fall back to
$XDG_CONFIG_HOME/claude/claude.jsonbefore falling back to~/.claude.json?This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.