環境変数

CLAUDE_CONFIG_DIR

設定ディレクトリを上書きする(既定: ~/.claude)。すべての設定・セッション履歴・プラグインがこのパスの下に保存される。認証情報については、Claude Code が認証情報を保存する場所を参照。複数アカウントを並行して実行する場合に有用で、例えば alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude' のように使える。シェル・ユーザー設定・管理対象設定のいずれかに設定する。設定ファイル内では絶対パスで記述する。プロジェクト設定とローカル設定では無視される。

使い方・用途

  • 設定ディレクトリを ~/.claude 以外に移して、~ の容量やバックアップ方針から切り離して管理したいときに使う
  • 複数アカウントを併用したいときに、alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude' のようにアカウントごとに別の設定ディレクトリへ振り分けるのに使う
  • devcontainer など再ビルドでホームディレクトリが消える環境で、ボリュームマウントしたパスに CLAUDE_CONFIG_DIR を設定して認証情報や設定・セッション履歴を永続化したいときに使う
英語原文(公式ドキュメントより)

Override the configuration directory (default: ~/.claude). All settings, session history, and plugins are stored under this path. For credentials, see where Claude Code stores credentials. Useful for running multiple accounts side by side: for example, alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'. Set it in your shell, user settings, or managed settings. In a settings file, write the absolute path. Ignored in project and local settings

関連する変更履歴

v2.1.284(1件)

Changed
[VSCode] claudeCode.environmentVariables 設定内の CLAUDE_CONFIG_DIR を絶対パスの場合にのみ適用するように変更し、会話を引き継ぐターミナルに引き渡すようにした。
英語原文を表示
[VSCode] Changed CLAUDE_CONFIG_DIR in the claudeCode.environmentVariables setting to apply only when it is an absolute path, and passed it to terminals that continue the chat

v2.1.275(1件)

Fixed
[VSCode] environmentVariables 設定の空の CLAUDE_CONFIG_DIR エントリにより、Claude Code がワークスペース内にファイルを保持してしまう問題を修正した。
英語原文を表示
[VSCode] Fixed an empty CLAUDE_CONFIG_DIR entry in the environmentVariables setting making Claude Code keep its files in the workspace

v2.1.274(1件)

Fixed
[VSCode] Environment Variables 設定で CLAUDE_CONFIG_DIR を変更した後、ターミナルでのサインインやサインアウトがリロードまで表示されない不具合を修正した
英語原文を表示
[VSCode] Fixed sign-ins and sign-outs made in a terminal not showing until a reload after CLAUDE_CONFIG_DIR changed in the Environment Variables setting

関連ドキュメント

v2.1.271(1件)

Fixed
[VSCode] environmentVariables 設定で CLAUDE_CONFIG_DIR を変更した後、ウィンドウを再読み込みするまで開いているタブやサイドバーに古い設定フォルダーが残る問題を修正しました
英語原文を表示
[VSCode] Fixed open tabs and the side bar keeping the old config folder until a window reload after CLAUDE_CONFIG_DIR changed in the environmentVariables setting

関連ドキュメント

v2.1.269(1件)

Fixed
[VSCode] 設定ファイルや environmentVariables 設定で CLAUDE_CONFIG_DIR が設定されている場合に、セッションリストがデフォルトフォルダのセッションを保持し続ける問題を修正した
英語原文を表示
[VSCode] Fixed the session list keeping sessions from the default folder when CLAUDE_CONFIG_DIR is set in a settings file or the environmentVariables setting

v2.1.268(2件)

Fixed
[VSCode] 設定ファイルまたは environmentVariables 設定で CLAUDE_CONFIG_DIR が設定されている場合に、セッションリストや設定のトグル、チャットタブが正しく動作しない問題を修正しました。
英語原文を表示
[VSCode] Fixed the session list, settings toggles, and chat tabs when CLAUDE_CONFIG_DIR is set in a settings file or the environmentVariables setting
Fixed
[VSCode] 設定経由で CLAUDE_CONFIG_DIR が設定されている場合に、カスタムスタイルビルダーが CLI が読み取らないフォルダに User レベルのスタイルを保存してしまう問題を修正しました。
英語原文を表示
[VSCode] Fixed the custom style builder saving a User level style in a folder the CLI does not read when CLAUDE_CONFIG_DIR is set through settings

関連ドキュメント

v2.1.251(1件)

Changed
プロジェクトレベルの .claude/settings.json の env が、CLAUDE_CONFIG_DIR、CLAUDE_CODE_TMPDIR、TMPDIR/TMP/TEMP を設定できないように変更した。これらはシェル、ユーザー、またはマネージド設定で設定する必要がある。
英語原文を表示
Changed project-level .claude/settings.json env to no longer set CLAUDE_CONFIG_DIR, CLAUDE_CODE_TMPDIR, or TMPDIR/TMP/TEMP; set them in your shell, user, or managed settings instead

変更後

悪意あるリポジトリがClaude Codeの設定保存先や一時ディレクトリの書き換えを通じてファイルの保存場所を操作できなくなったことで、リポジトリを開くだけの安全な環境が保たれる。

関連ドキュメント

v2.1.208(1件)

Fixed
ワークフロー保存ダイアログにおいて、ユーザー指定の保存先が CLAUDE_CONFIG_DIR ではなく誤って ~/.claude/workflows/ と表示される問題を修正した。
英語原文を表示
Fixed the workflow save dialog showing ~/.claude/workflows/ instead of the CLAUDE_CONFIG_DIR location for user-scope saves

変更後

設定ファイルを標準以外の場所に置いている場合でも、ワークフローの保存先を迷わず確信できるようになります。

関連ドキュメント

v2.1.136(1件)

Fixed
IDEシェル統合用のロックファイルが、CLAUDE_CONFIG_DIR による設定ディレクトリの変更を反映していない問題を修正しました。
英語原文を表示
Fixed IDE shell-integration lock files not respecting CLAUDE_CONFIG_DIR

変更後

設定ディレクトリを完全に分離して、複数の Claude Code インスタンスを安全に並列実行できるようになります。

関連ドキュメント

v2.1.111(1件)

Improved
/setup-vertexと/setup-bedrockにおいて、CLAUDE_CONFIG_DIR設定時のパス表示の正確化、既存設定の再利用、および100万トークンのコンテキストオプションの提示といった改善を行いました。
英語原文を表示
Improved /setup-vertex and /setup-bedrock to show the actual settings.json path when CLAUDE_CONFIG_DIR is set, seed model candidates from existing pins on re-run, and offer a "with 1M context" option for supported models

変更後

クラウドプロバイダー経由での利用開始や設定変更がより迅速かつ確実になり、特に大規模プロジェクトでのセットアップが楽になります。

関連ドキュメント

v1.0.6(1件)

Changed
Respect CLAUDE_CONFIG_DIR everywhere