[BUG] Running Claude Code causes all running apps to crash - MacOS
Status Fixed / completed
Maintainer reply ✓ Yes — wolffiex
Activity 12 comments · opened Mar 11, 2025 · closed Mar 21, 2025
💡 Likely answer: A maintainer (wolffiex, collaborator)
responded on this thread — see the highlighted reply below.
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 0.2.36 on Node version: v22.14.0
- Operating System: macOS 14.7.1
- Terminal: iTerm2
Bug Description
After updating to 0.2.36 when I run claude in a directory I previously it with, I see the welcome message and immediately all my open apps close, including the iTerm2 app I'm running claude in. Some apps will reopen automatically but most will not, including widgets that live in my macOS toolbar (like Alfred), requires logging out and back in to restore.
Steps to Reproduce
- run
claude
Expected Behavior
Apps don't crash
Actual Behavior
All open apps crash.
Additional Context
There's no output to capture from claude because the terminal closes before I can copy anything.
12 Comments
There is no output from
claude --debug --verboseto help. I tried a screen recording but it crashes before it can save the file. Best I could do was take a video from my phone.https://github.com/user-attachments/assets/54430fea-bd6d-43f0-bfed-abb73e152c10
Downgrading to
0.2.35fixes the issue, no crashes so far. I have disabled auto update for now.wow thank you for this report
are you using
claude's MCP features by chance? do you have Claude Desktop installed?i do have Claude Desktop installed with multiple MCP servers that I use without issue. I did use MCP servers with Claude Code but I made sure to remove them before I reproduced the issue for this bug report.
The issue is happening with Claude 0.2.50 as well. I reverted to 0.2.49 and disabled auto update, that does not crash.
Sorry for this bad crash. I have a feeling this may be related to the way that claude code tries to source your .zshrc file.
In Claude's shell, CLAUDECODE env var is set. Any chance you can condition the logic in your .zshrc file to identify what may be causing this crash? It would us tremendously to narrow down the issue.
@wolffiex good call. This is the part that's breaking it:
And the contents of my
nvm.shthat it's sourcing there:ok wow interesting, thanks so much for bisecting. hoping you can use CLAUDECODE for now to keep this from crashing (and turn the auto-updater back on :) and I will work on the repro and the fix
Ok, looking at this more closely, I think this is the issue:
The real problem is a potential infinite recursion loop:
export NVM_DIR=~/.nvm
[ -s "$(brew --prefix nvm)/nvm.sh" ] && source "$(brew --prefix nvm)/nvm.sh"
/usr/local/Cellar/nvm/0.40.1/libexec/nvm.sh which might be creating a recursive
sourcing situation
entire terminal
nvm.sh file is suspicious - the backslash before the dot (.) forces sourcing even if
the file was already sourced
To fix this, the user should:
export NVM_DIR=~/.nvm
[ -s "/usr/local/opt/nvm/nvm.sh" ] && source "/usr/local/opt/nvm/nvm.sh"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
The problem appears to be that the nvm.sh script might be sourcing itself recursively
through a combination of the brew --prefix command and how nvm sets up its paths,
causing a terminal crash.
If you want to keep the logic as-is you can always use CLAUDECODE env var to condition it, but it seems like this may be a mistake in your shell logic
I'm also seeing this same issue but don't have NVM
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.