Skip to content

burakdede/claude-code-uninstaller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Claude Code Uninstaller

Anthropic's native binary installation (currently in beta) doesn't provide an uninstall method. This script removes both npm and native binary installations completely.

Use Anthropic's official uninstall when they release one. This is a temporary solution.

Why This Exists

The native binary installation lacks proper uninstall functionality, and having both npm and native binary versions installed can cause conflicts and break your local setup. Common issues include:

  • Mixed installations pointing to different binaries
  • Shell completions from both versions conflicting
  • PATH resolution picking the wrong installation
  • npm's uninstall failing with ENOTEMPTY errors

This script provides a clean slate by removing all Claude Code installations and configurations, regardless of how they were installed.

Usage

chmod +x uninstall-claude.sh
./uninstall-claude.sh

Options:

  • --force - Skip prompts
  • --quiet - Silent mode (implies --force, perfect for scripts)
  • --help - Show help

Examples:

# Interactive (asks before removing ~/.claude)
./uninstall-claude.sh

# Automation/CI-CD
./uninstall-claude.sh --quiet

What Gets Removed

  • Binaries: ~/.local/bin/claude, /usr/local/bin/claude, etc.
  • NPM packages: Global installations and broken leftovers
  • Shell configs: Removes Claude lines from .bashrc, .zshrc, etc. (creates backups)
  • Data directory: ~/.claude (prompts unless --force)

Safety Features

Shell config backups: Before modifying any shell config file, creates timestamped backups:

~/.zshrc.claude-backup.20250904-143022

Path validation: Only removes the expected ~/.claude directory, refuses to delete unexpected paths.

Binary safety: Only removes files ending with /claude from PATH to prevent accidents.

Exit codes: Returns 0 on success, non-zero if any major operation failed (good for CI/CD).

NPM-Only Users

Just use npm's official command:

npm uninstall -g @anthropic-ai/claude-code

But if that fails with ENOTEMPTY errors (common), run this script instead.

Troubleshooting

"Could not remove" warnings:

# Script shows exact commands to run
sudo rm -f /usr/local/bin/claude

Claude still in PATH after uninstall:

  1. Restart terminal
  2. Run ./cc-uninstall.sh --force again

For automation: Script returns exit code 0 on success, non-zero if issues occurred.

Platform Support

  • macOS (Intel/Apple Silicon)
  • Linux (x64/ARM, including Alpine/musl)
  • Windows via WSL

License

MIT License - see LICENSE file for details.

Use at your own risk. Script removes files and directories.

About

Complete Claude Code uninstaller for npm and native binary installations.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages