• AgentArmor teamTeam3d agoNeeds helpSolved

    Claude Code uses ~/.claude instead of XDG directories on Linux. How do I control where it stores config?

    On Linux, Claude Code creates ~/.claude.json and ~/.claude rather than following the XDG Base Directory spec. Users who set XDG variables expect Claude Code to use the XDG paths by default. Reports across versions 1.0.29 to 1.0.34 disagree about which directory is read, so settings appeared to move or disappear.

    Originally asked on GitHub: https://github.com/anthropics/claude-code/issues/1455

    4 answers

    • Best answerAgentArmor teamTeam3d ago

      Status: open. The thread shows no maintainer fix, and the reported behavior differs by version. One user confirmed reads from ~/.config/claude/CLAUDE.md on 1.0.29, another said 1.0.31 read from ~/.config/claude, while others reported Claude Code using ~/.claude on 1.0.31 and on a fresh install of 1.0.34. A commenter noted that the partial change did not migrate existing data from ~/.claude to ~/.config/claude, and no automatic migration is described.

      Workarounds from the thread:

      1. Set CLAUDE_CONFIG_DIR. One user kept the old location with a fish alias:
      fish
      alias claude="env CLAUDE_CONFIG_DIR=$HOME/.claude $HOME/.claude/local/claude"
      

      They said this seems to return the old behavior and was the only approach that worked consistently for them.

      1. Symlink the legacy directory to the XDG location with ln -s "$HOME/.config/claude/" "$HOME/.claude". The user described this as temporary and reported no outcome.

      General advice, not from the thread: back up both ~/.claude and ~/.config/claude before changing versions, since settings can seem to vanish when the active directory changes.

      Security note: one commenter warned that an API key stored in the config directory could be pushed to a config repo, so keep that directory out of version control.

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @joshuadavidthomas tried on GitHub (Worked)

      Set CLAUDE_CONFIG_DIR=$HOME/.claude through a fish alias pointing at the local claude binary to keep the old behavior.

      Source: https://github.com/anthropics/claude-code/issues/1455#issuecomment-3005066638 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @JacobHayes tried on GitHub (Outcome unclear)

      Created a symlink with ln -s "$HOME/.config/claude/" "$HOME/.claude" to force the .config location while waiting for a fix.

      Source: https://github.com/anthropics/claude-code/issues/1455#issuecomment-3000881315 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @milanglacier tried on GitHub (Outcome unclear)

      On a fresh install of v1.0.34, Claude Code created its data under ~/.claude rather than ~/.config/claude and ~/.local/share/claude.

      Source: https://github.com/anthropics/claude-code/issues/1455#issuecomment-3002649704 (opens external site)

      Did this work for you?

    Add your answer or comment