Guides

CLAUDE_CONFIG_DIR explained

By jhyunwoo
Last updated November 29, 2026
Checked with ccam 0.16.1 and Claude Code 2.1.302

On this page

CLAUDE_CONFIG_DIR tells Claude Code which folder to use instead of ~/.claude. Everything account-specific lives there: the login, settings, MCP servers, plugins and conversation history. Pointing it at different folders gives you separate accounts.

CLAUDE_CONFIG_DIR=~/.claude-work claude

Is CLAUDE_CONFIG_DIR officially supported?

Yes. Claude Code lists it among its environment variables as the way to override the configuration folder, "useful for running multiple accounts side by side", and its authentication guide uses it for logging in with several accounts. You can set it in your shell or in user settings, but not in a project's settings.

What is inside the folder?

Checked with Claude Code 2.1.309:

Path Contents Shareable
.credentials.json Login tokens (Linux, Windows), MCP OAuth tokens No
.claude.json Account details, user MCP servers, per-project state No (MCP servers separately)
settings.json Permissions, hooks, model, status line, plugins Yes
CLAUDE.md Global instructions Yes
agents/, commands/, skills/, plugins/ Extensions Yes
projects/ Conversations as .jsonl files, per-project memory Yes
history.jsonl Prompt history Yes
sessions/, shell-snapshots/, cache/ and others Runtime state No

What trips people up?

Without CLAUDE_CONFIG_DIR, .claude.json is not inside ~/.claude. Claude Code then keeps it at ~/.claude.json, next to the folder. If you start using CLAUDE_CONFIG_DIR=~/.claude, Claude Code looks for ~/.claude/.claude.json instead and does not find your account. ccam import handles this by linking the two. If ~/.claude already has a .claude.json of its own, from an earlier run with CLAUDE_CONFIG_DIR=~/.claude, ccam leaves both files and says so, since only you know which one is right.

On macOS the login is in the Keychain, not in the folder. Claude Code stores it under the name Claude Code-credentials. When CLAUDE_CONFIG_DIR is set, the name also ends with - and the first 8 hex digits of the SHA-256 of the folder path. The Keychain item's account name is $USER. Separate folders therefore get separate Keychain entries, and a folder that is moved or renamed loses its login; that is why ccam rename keeps the folder's name on macOS. If the Keychain refuses the write, Claude Code falls back to .credentials.json in the folder, as its documentation describes.

Not every sign-in lives in the folder. A Claude Console sign-in without an API key is stored outside it, so separate folders cannot keep two such sign-ins apart. claude.ai logins and API keys are kept per folder.

Where is the folder on Windows?

By default it is %USERPROFILE%\.claude. The login is in .credentials.json inside it, or in Windows Credential Manager if Claude Code is set to use it, under a name derived from the folder path as on macOS. Set CLAUDE_CONFIG_DIR to another folder for each extra account, the same way as on Linux and macOS.

Can folders share files?

Symbolic links work: Claude Code reads and writes through a linked settings.json or projects/ folder and keeps the link. MCP servers are the exception, because they share .claude.json with the login; pass them with --mcp-config instead.

ccam builds on exactly these rules. See sharing for how it links folders, and the guide to multiple accounts for the bigger picture.