Update (2025-01-25): This issue appears to be fixed in Claude Code v2.1.19. Update with
brew upgrade claude. Keep this tool just in case the issue resurfaces.
A temporary workaround for the Claude Code orphan process issue on macOS.
When closing terminal applications (iTerm2, PyCharm, etc.) without explicitly exiting Claude Code, processes become orphaned and continue running in the background, consuming significant memory.
- Related issue: anthropics/claude-code#17391
- Multiple
claudeprocesses visible in Activity Monitor - High memory usage (can reach several GB)
- Processes persist even after closing all terminals
- Download
claude_cleanup.command - Double-click to run
- Follow the on-screen prompts
# Kill all Claude processes
pkill -9 claudeUntil the bug is fixed, properly exit Claude Code before closing the terminal:
- Type
/exitin Claude Code - Or press
Ctrl+CthenCtrl+D - Or press
Ctrl+Dtwice
This is a temporary workaround. Once issue #17391 is resolved, this tool will no longer be necessary.