Before starting the uninstallation, it's recommended to backup important configuration files and project data.
npm ls -g @anthropic-ai/claude-code
npm ls @anthropic-ai/claude-code
# View global package installation path
npm root -g
# View Claude Code executable location
which claude
# Or on Windows use
where claude
# Uninstall globally installed Claude Code
npm uninstall -g @anthropic-ai/claude-code
# Verify uninstallation
claude --version
# Should show "command not found" or similar error
# Uninstall locally installed Claude Code in project directory
npm uninstall @anthropic-ai/claude-code
# Check if dependency is removed from package.json
cat package.json | grep claude
# Delete global installation directory
rm -rf ~/.npm/lib/node_modules/@anthropic-ai/claude-code
rm -rf /usr/local/lib/node_modules/@anthropic-ai/claude-code
# Delete executable file link
rm -f /usr/local/bin/claude
# Delete user data directory
rm -rf ~/.claude-code
rm -rf ~/.config/claude-code
# Delete global installation directory
rmdir /s "%APPDATA%\npm\node_modules\@anthropic-ai\claude-code"
# Delete user data directory
rmdir /s "%APPDATA%\claude-code"
rmdir /s "%LOCALAPPDATA%\claude-code"
# Delete global installation directory
Remove-Item -Recurse -Force "$env:APPDATA\npm\node_modules\@anthropic-ai\claude-code" -ErrorAction SilentlyContinue
# Delete user data directory
Remove-Item -Recurse -Force "$env:APPDATA\claude-code" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\claude-code" -ErrorAction SilentlyContinue
# Edit configuration files, delete related environment variables
nano ~/.bashrc
nano ~/.bash_profile
nano ~/.zshrc
# Delete the following lines:
# export ANTHROPIC_AUTH_TOKEN=...
# export ANTHROPIC_BASE_URL=...
# Reload configuration
source ~/.bashrc
source ~/.bash_profile
source ~/.zshrc
Method 1: GUI
ANTHROPIC_AUTH_TOKENANTHROPIC_BASE_URLMethod 2: PowerShell
# Delete user environment variables
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", $null, "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", $null, "User")
# Delete system environment variables (requires administrator privileges)
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", $null, "Machine")
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", $null, "Machine")
Check and delete Claude Code related configuration in the project:
# Find configuration files in project
find . -name ".claude*" -type f
find . -name "claude.config.*" -type f
# Delete found configuration files
rm -f .claude-settings.json
rm -f claude.config.js
rm -f claude.config.json
# Clean Claude Code related data in npm cache
npm cache clean --force
# Clean user cache directory
rm -rf ~/.cache/claude-code
rm -rf /tmp/claude-*
# Clean log files
rm -rf ~/.local/share/claude-code/logs
# Clean npm cache
npm cache clean --force
# Clean user cache directory
Remove-Item -Recurse -Force "$env:TEMP\claude-*" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "$env:APPDATA\claude-code\cache" -ErrorAction SilentlyContinue
# Clean log files
Remove-Item -Recurse -Force "$env:APPDATA\claude-code\logs" -ErrorAction SilentlyContinue
After completing the uninstallation, run the following commands to verify complete cleanup:
# Verify command doesn't exist
claude --version
# Should show "command not found"
# Verify environment variables are cleaned
echo $ANTHROPIC_AUTH_TOKEN
echo $ANTHROPIC_BASE_URL
# Should be empty
# Check for residual files
ls -la ~/.claude* 2>/dev/null || echo "No Claude files found"
ls -la ~/.config/claude* 2>/dev/null || echo "No Claude config found"
If you no longer need Node.js or other related tools, you can uninstall them as well:
# If installed via Homebrew
brew uninstall node
# Manual deletion (if installed via official installer)
sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}
# If installed via apt
sudo apt-get remove nodejs npm
sudo apt-get autoremove
# Uninstall via Winget
winget uninstall OpenJS.NodeJS
# Uninstall via Chocolatey
choco uninstall nodejs
# Uninstall via Control Panel
# Control Panel → Programs → Uninstall a program → Find Node.js → Uninstall
Possible causes:
Solution:
# Reload environment variables
source ~/.bashrc
# Or restart terminal
exit
# Reopen terminal
# Check all possible installation locations
which -a claude
whereis claude
Solution:
# macOS/Linux use sudo
sudo rm -rf /usr/local/lib/node_modules/@anthropic-ai/claude-code
# Windows run PowerShell as administrator
# Right-click PowerShell → "Run as administrator"
Solution:
# Check all possible configuration files
grep -r "ANTHROPIC" ~/.*rc ~/.*profile 2>/dev/null
grep -r "claude" ~/.*rc ~/.*profile 2>/dev/null
# Manually edit found configuration files
nano ~/.bashrc # Delete related lines
If you need to reinstall Claude Code later:
npm cache clean --forceAfter completing the above steps, Claude Code should be completely uninstalled from your system.