Claude Code Uninstallation Guide

Complete Claude Code uninstallation process, including cleaning configuration files, environment variables, and cached data.

Pre-uninstallation Check

Before starting the uninstallation, it's recommended to backup important configuration files and project data.

Check Installation Method

Step 1: Check global installation

bash
npm ls -g @anthropic-ai/claude-code

Step 2: Check local installation

bash
npm ls @anthropic-ai/claude-code

Step 3: Check installation path

bash
# View global package installation path
npm root -g

# View Claude Code executable location
which claude
# Or on Windows use
where claude

Uninstall Claude Code

# Uninstall globally installed Claude Code
npm uninstall -g @anthropic-ai/claude-code

# Verify uninstallation
claude --version
# Should show "command not found" or similar error

Method 2: Manual deletion (If npm uninstall fails)

# 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

Clean Configuration Files and Cache

Clean Environment Variables

macOS/Linux Systems

bash
# 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

Windows Systems

Method 1: GUI

  1. Right-click "This PC" → "Properties"
  2. Click "Advanced system settings"
  3. Click "Environment Variables" in the "System Properties" window
  4. Find and delete in User variables and System variables:
    • ANTHROPIC_AUTH_TOKEN
    • ANTHROPIC_BASE_URL
  5. Click "OK" to save

Method 2: PowerShell

PowerShell (Administrator)
# 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")

Clean Project Configuration Files

Check and delete Claude Code related configuration in the project:

bash
# 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 Cache Data

# 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

Verify Uninstallation

After completing the uninstallation, run the following commands to verify complete cleanup:

bash
# 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:

Uninstall Node.js

# 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.*}

Common Issues

Issue 1: Command still exists

Possible causes:

  • PATH environment variable cache
  • Multiple installation locations

Solution:

bash
# Reload environment variables
source ~/.bashrc

# Or restart terminal
exit
# Reopen terminal

# Check all possible installation locations
which -a claude
whereis claude

Issue 2: Insufficient permissions to delete files

Solution:

bash
# 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"

Issue 3: Environment variables not cleaned

Solution:

bash
# 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

Preparation for Reinstallation

If you need to reinstall Claude Code later:

  1. Ensure Node.js version ≥ 18.0
  2. Clean npm cache: npm cache clean --force
  3. Reinstall according to the installation documentation

After completing the above steps, Claude Code should be completely uninstalled from your system.

Bring endless innovation and opportunities with AI
About
Features
Docs
Pricing
Contact us
Terms & Policies
Terms of Use
Privacy Policy
Specified Commercial Transactions Act