claude-code
claude-code copied to clipboard
Shell Configuration Not Loaded in Claude Code Bash Execution
Bug Description Claude Code Bash tool doesn't load user shell configuration
The Bash tool executes commands without loading the user's shell configuration, even when their default shell is zsh. This creates a disconnect between the user's normal terminal experience and Claude Code's execution environment.
Expected behavior: Commands should have access to user-defined aliases, functions, and shell configuration.
Actual behavior:
- echo $SHELL returns /bin/zsh
- User aliases defined in ~/.zshrc.d/ return "command not found"
- zsh -c 'source ~/.zshrc && type aliasname' works correctly, confirming the configuration is valid
- Commands execute in a minimal environment without user customizations
Impact: Users cannot use their normal shell aliases and functions, forcing them to use full command paths or work around their established workflows.
Suggested solutions:
- Source the user's shell configuration files (.zshrc, .bashrc) before command execution
- Add a setting to enable/disable loading user configuration
- Document that commands run in a minimal environment if this is intentional behavior
Environment:
- macOS Darwin 24.5.0
- Default shell: zsh
- Shell configuration loads correctly in normal zsh sessions
Environment Info
- Platform: macos
- Terminal: tmux
- Version: 1.0.11
- Feedback ID: eabc0487-9a0a-4014-807f-a35ffd86f004