What this thread does
As of November 2026, CLAUDE_CONFIG_DIR is the documented directory override, with authentication exceptions. Do first: set it in the launching shell to an absolute directory path; project and local settings cannot select it. Environment reference.
The problem
Claude Code writes its settings, history and credentials to a .claude folder and a separate .claude.json file in your home directory, rather than the XDG folders many Linux and dotfile-managed setups expect. The GitHub issue was opened by jennifgcrl on 2025-05-31. As of 17 November 2026, it remains open.
What the maintainer said
In June 2025 maintainer chrislloyd wrote that partial XDG support was shipped in version 1.0.28 and withdrawn in 1.0.31, because users who got the new layout were asked to sign in again and the implementation did not fully follow the spec. He did not give a date for a return. Commenters in the thread reported that settings seemed to vanish while the paths moved.
The workaround commenters rely on
- Set the
CLAUDE_CONFIG_DIRenvironment variable to the folder you want. Commenters say it takes precedence over the default. The official changelog mentions this variable in many entries, including VS Code settings and path rules, so it is a supported variable. The environment-variable reference documents the override and says it can be set in the shell, user settings or managed settings, but is ignored in project and local settings. In settings JSON, use an absolute path. - A commenter reported on version 2.1.139 (May 2026) that it also relocates the JSON file: the app looks for that file inside the folder, not in your home directory. Their example sets the variable to a claude folder under your XDG config directory.
- Set it in your shell startup file or launcher. The changelog says the project-level settings file's env block no longer sets this variable (use the shell, user or managed settings).
What it does not do
- It is not full XDG compliance: everything goes into one folder, not split into config, data and cache. A commenter who analyzed their install also noted most of that folder is not configuration.
- Back up existing files before changing paths. A new directory has its own settings, session history and claude.ai login or API key. However, two Claude Console sign-ins without API keys are not isolated by this variable, because that login is stored outside the configuration directory. Authentication docs.
- Older reports (late 2025 to January 2026) say the variable alone did not stop the home folder or the file from being created, that a stored editor mode still landed in the JSON file, and that replacing the JSON file with a symlink failed because the CLI recreated it as a regular file. The May 2026 report suggests that changed, but behavior can differ by version.
- The installer still places the program in the user's local bin folder, a different location from config.
Commenters also shared a sandbox-wrapper script that remaps the legacy paths; it is outside the scope of this configuration override.
This thread is about relocating one config folder. Running several accounts side by side, with a folder per account, is a different use covered in another thread.
Sources
- Claude Code environment variables: directory override, supported scopes and absolute paths in JSON.
- Authentication: per-directory claude.ai state and the exception for Claude Console sign-ins without API keys.
- Issue 1455: open XDG request, withdrawn partial support and version-specific migration reports.
- Claude Code changelog: configuration-directory fixes and environment restrictions.
Started from a post by @jennifgcrl, packaged by the editor. Original post