[BUG] bash commands broken in 0.2.39+
Resolved 💬 23 comments Opened Mar 25, 2025 by hyperknot Closed Apr 25, 2025
💡 Likely answer: A maintainer (wolffiex, collaborator)
responded on this thread — see the highlighted reply below.
My previous issue got closed as fixed, but the fix is not working. Even latest versions cannot run bash commands for me.
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 0.2.53 (Claude Code)
- Operating System: macOS 15.3.1
- Terminal: iterm2
Bug Description
The 0.2.39 broke bash command running, it waits forever before running the commands. Every version since is broken.
Bash(pnpm typecheck)…
✽ Doing… (65s · esc to interrupt)
Steps to Reproduce
- Ask to run some harmless bash command like
pnpm typecheckin my case.
Expected Behavior
Ask and run
Actual Behavior
Not asking and stalling
The only current way to fix it is to disable autoupdate and revert to 0.2.38
claude config set -g autoUpdaterStatus disabled
npm -g install @anthropic-ai/claude-code@0.2.38
23 Comments
@hyperknot Are you able to confirm that the same specific command (
pnpm typecheck) works on the old version?Yes, of course. It's not just this command, any bash command, even if I ask what shell is being used for example.
https://github.com/anthropics/claude-code/issues/466#issuecomment-2746477883
hi @hyperknot we changed how find the bash or zsh executable around 0.2.38
what shell are you running when you invoke claude?
are you running nix?
can you find an executable for bash or zsh that works when you run it from the command line? if so, what is the path?
I use a standard macOS setup with homebrew bash.
thanks for the info. could you please try v0.2.49?
Not working:
ok and just to confirm, the shell is broken in 0.2.39?
this is most likely a problem with the way we source your bashrc
one way to narrow this down in the latest release would be to condition the logic in your bashrc to skip sections if CLAUDECODE is set and see if there may be some specific lines in there that are causing problems
This is my bashrc, it's almost empty.
Yes
ok, the change from 38->39 was to cd back to the original working directory after sourcing your bashrc
have you tried running claude from a different directory, especially not $HOME?
I never run it from $HOME, just some project folders locally.
On 2025. Mar 25., Tue at 18:05, Adam Wolff @.***> wrote:
Any fixes here?
yes, we have a new shell implementation that we expect to roll out today. stay tuned
Seems to be working as of today.
Can you confirm this was changed?
oh yes, we have made many changes here. if you see new issues, please let us know!
Any way we can opt-in to the old behavior?
I've been trying to debug my osx bash ~/.bash_profile -> ~/.bashrc -> ~/.profile configuration and what's changed and haven't had success even figuring out what the error is. Claude just says "Error'. 0.2.38 is the last version which I can use which can make bash shell commands. claude 1.0.3 etc and read and write file, but not execute shell commands, and it can't tell me what's wrong. I've even tried just logging everything like
ANTHROPIC_LOG=debug DEBUG=true ~/.claude/local/claude --verbose --debug -p "print the output of the PATH environmental variable to PLAN_DEBUG.md"
but I don't get anything useful. I've stepped through my dotfiles exhaustively and haven't yet figured out what changed after 0.2.38 which makes claude say: "I need permission to use the Bash tool. Could you grant me Bash permissions so I can retrieve the PATH environment variable and save it to PLAN_DEBUG.md?"
I'll open a support case as well, but want to 👍 I've been working around this for a while as well as trying to debug it and wonder if I can just opt in to the old behavior and profit.
Here's my hack to opt myself out
alias claude="CLAUDE_DOTFILES=true ~/.claude/local/claude"<Details>
<Summary>
I asked claude to review diff the 0.2.38 to 0.2.39 npm packages for bash profile changes
</Summary>
⏺ Based on my examination of the patch, I can identify a significant
change in how Claude Code handles shell initialization and
environment. The key changes are related to shell profile sourcing.
Here's a prettified JavaScript diff showing the changes:
The key changes in version 0.2.38 are:
configuration file based on the shell type:
user's shell profile file with:
this.sendToShell(
source ${W} && cd ${I});This is a significant improvement because:
files, which meant that:
...defined in .bashrc or .zshrc were not available to commands
executed through Claude Code.
what users would have in their regular terminal, ensuring consistency
between Claude-executed commands and commands run directly in the
terminal.
This change improves the user experience by making Claude Code work
more seamlessly with the user's existing shell setup and environment.
</Details>
Sorry that you are stuck. We removed the old functionality so there's no easy way to opt out. You can condition the logic in your dotfiles on the existence or truth of the
CLAUDE_CODEenv var. If you are able to track down the issue I'll be happy to fix it in the product. What shell do you use to invoke claude code?@wolffiex Thanks for the quick response. I know this was a bit of issue necromancy... I use bash 4, installed via homebrew on a recent m1 osx. Now that I've isolated it to some effect of sourcing my dotfiles, I can isolate it further.. but since I have something working now, it's less urgent, and more curiosity and being a good OSS citizen :)
@wolffiex I can make a new issue at this point. I isolated it to
and then I further isolated it and determined the fix was to change that line to
some more info in https://gist.github.com/bf4/2d45489f044d3ec2ccaae528e5e98088
wow, thank you for tracking this down @bf4 ! I'll make our shell startup logic more robust to config script errors
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.