Repository navigation
fix(claude): set XDG and tool directories in the Claude settings env - #122
Merged
Merged
Conversation
Bash commands inherit the environment of the process that launched Claude Code, and the shell snapshot keeps only PATH. A desktop-launched session therefore lacked XDG_RUNTIME_DIR, and pnpm 12.18 failed to open its store lock inside the sandbox.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claude Code's Bash commands inherit the environment of the process that launched Claude Code, and the shell snapshot keeps only
PATH. The desktop app starts from launchd, outside fish, so its sessions had noXDG_*variables orPNPM_HOME. WithoutXDG_RUNTIME_DIR, pnpm 12.18 fails inside the sandbox withERR_PNPM_STORE_DIR_OPEN_OPERATION_LOCK.The settings
envblock now sets the XDG base directories,XDG_RUNTIME_DIR,PNPM_HOME,MISE_CACHE_DIR, and theHOMEBREW_NO_*flags to the values the fish config uses. Theenvblock takes literal values only, so chezmoi renders the paths from.chezmoi.homeDir. The block reaches the Claude process, hooks, and every Bash command, whether or not the mise hook runs. Setting the values in mise[env]instead would also change interactive shells, and mise readsMISE_CACHE_DIRbefore it loads its config.The values must stay in step with
managed/dot_config/fish/conf.d; a comment on the block says so.