Add environment variable to configure .claude config directory location
Status Fixed / completed
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 12 comments · opened Feb 14, 2026 · closed Aug 17, 2026
Users who work across multiple machines and use a portable home directory (e.g., a shared filesystem mounted at a consistent path) cannot easily relocate ~/.claude/ to their preferred location. An environment variable like CLAUDE_CONFIG_DIR (similar to how XDG_CONFIG_HOME works for other tools) would allow users to store Claude Code's config, credentials, history, and session data in a location of their choosing instead of being hardcoded to ~/.claude/.
Showing cached comments. Read the full discussion on GitHub ↗
11 Comments
Please also consider the file
~/.claude.json. For example it has its value when using a docker container and we want to mount claude config, without mounting the whole home directory+1 for this. This behavior is really annoying. At the very least,
XDG_CONFIG_DIRshould be used for the config - as is the convention on Linux!CLAUDE_CONFIG_DIRalready exists and works — I built a CLI that makes it easy to manage:Each profile is a complete, isolated directory. Works in Docker too — just mount the profile directory as
CLAUDE_CONFIG_DIR.https://github.com/synth1s/cloak
+1.
~/.claude/CLAUDE.md is just too much noise for things not related to programming. So while my home directory needs to be defaulting to programming, I need an alternate one for non-programming tasks.
@goulartfs thanks for pointing out the existence of the env variable.
Also, appreciate the work you've done, but do we really need to install an untrusted nodejs program to simply change an env variable?
CLAUDE_CONFIG_DIR - Aha, I guess I missed that! So should this ticket be closed?
Fair point! You absolutely can use
CLAUDE_CONFIG_DIRdirectly — no tool needed.Cloak just wraps the manual steps: creating profile directories, copying config files, switching the env var across shell sessions, and handling the shell integration (since a child process can't modify the parent's env).
If you're comfortable managing that yourself, the env var alone works perfectly. Cloak is for those who prefer not to think about it.
claude /contextshows that if you have a~/.claude/CLAUDE.mdeven whenCLAUDE_CONFIG_DIR=$HOME/.claude-raw/it still uses~/.claude/CLAUDE.mdand (as far as I can tell) ignores the one inCLAUDE_CONFIG_DIR.This is probably a separate bug - It means that if you have
~/.claude/CLAUDE.mdit will always work in place of any$CLAUDE_CONFIG_DIR/CLAUDE.mdyou might have.To work around that I've done the following, which allows you to separate CLAUDE.md by instance and still share the rest of the state:
DISCLAIMER: I have tested this procedure on my system, but not verbatim. I hand typed the following and have not tested it directly, so you're on your own for making this work right.
_If you break things it's not my fault!_ Verify my work before you perform any changes.
In .bashrc - update Claude so it sees the correct files:
Try it:
Write a script to run the
claude-rawinstance if you don't want to have your default CLAUDE.md. You could probably do this with an alias if you prefer.Try it:
If you did this right, then you can run
claude-raw /contextand it will not reference~/.claude-code/CLAUDE.mdbutclaude /contextwill.If you want any other separation between the instances, all you have to do is break the symlinks. The nice thing about this is that all the configurations, settings, and state exist across all instances. The only thing we've overwritten here are the instructions.
Hello, I had Claude write out the feature request from my pain points:
Feature Request: Make Claude Desktop Project Storage Location Configurable
Problem Statement
Claude Desktop currently saves all projects, artifacts, schedules, and metadata to a hardcoded default location:
~/Documents/Claude/Projects/(on macOS/Linux) orC:\Users\[username]\Documents\Claude\(on Windows).Users cannot change this default location, which creates friction in several scenarios:
Current Impact
Additional context - Cowork use case:
This issue is particularly acute when using Claude Desktop's Cowork feature. Because Cowork executes code and file operations directly, permission conflicts from non-standard project locations cause task failures and make it unreliable for building and testing skills/plugins in custom directories.
Suggested Solution
Add a Settings option in Claude Desktop UI (e.g.,
Settings > Projects > Default Project Location) that allows users to:Alternatively, support configuration via:
claude_desktop_config.jsonwith adefaultProjectPathfieldCLAUDE_PROJECTS_DIR(similar to how other tools likeCLAUDE_CONFIG_DIRwork)Suggested Config Format
Or via environment variable:
Use Cases
Backwards Compatibility
~/Documents/Claude/Projects/)Related Issues
Users have requested similar configurability for:
This suggests a broader need for path configurability across Claude's product family.
Expected Benefit
The feature already exists. See CLAUDE_CONFIG_DIR and comment above: https://github.com/anthropics/claude-code/issues/25762#issuecomment-4101143324
I sort of think this should be closed unless there's some other issue people are trying to solve.
You could also use a symbolic link to solve the problem, but just removing the entire claude directory is probably sufficient.
I just realized you're asking about the project's directory specifically, in which case there isn't a feature for that, but moving the dot claud directory is probably enough for most users. The report that you provided above should probably be in a new ticket.
Use case: solo developer, multiple personal machines, no multi-account need
I'm not after multi-account isolation or Docker mounts — just running Claude Code on more than one of my own machines (a primary workstation and a secondary laptop) and having my customizations follow me. Same user, same OS, same source tree (via git). The only thing that breaks the two-machine workflow is ~/.claude/: agents, slash commands, hooks, settings, and memory all stay on whichever machine I touched last.
What I've actually built around this: my project memory under ~/.claude/projects/<project>/memory/ is a Windows directory junction pointing at a git-backed location in the project repo. git pull on either machine and memory follows. It works because it's plain Markdown and the path is stable. But it doesn't help with agents/, commands/, hooks/, settings.json, or keybindings.json — all of which are also customizations I'd want shared.
CLAUDE_CONFIG_DIR would be the obvious answer, except the open bugs on this repo (#47056, #55065, #55249, #55456, #42217, #30538) make it clear it's not consistently honored across the CLI, subagents, MCP loading, and the VS Code extension. So in practice the env var doesn't yet provide a path to "put .claude somewhere portable and have everything just work." #50886 (.claude symlinked into a OneDrive-synced folder breaks with EEXIST) closes off the obvious cloud-sync workaround on Windows too.
What would unblock the two-machine workflow (in priority order):
Make CLAUDE_CONFIG_DIR consistently relocate everything Claude Code writes — including ~/.claude.json, subagent state, MCP config, IDE lock files. Treat the open bugs above as the implementation checklist.
Document which subdirectories are designed to be portable across machines vs. which are explicitly machine-local (auth, transcripts, telemetry). Without that, building a dotfiles-style sync repo is guesswork.
Stretch: a first-class claude config sync or similar that handles the safe-vs-local split explicitly.
The friction is real enough today that I've effectively pinned all my Claude Code work to one machine, even though my second machine is otherwise capable and I'd otherwise use it daily. I'd guess the population of "developers with a side machine" is non-trivial.