How to Uninstall Claude Code: Remove npm, Homebrew, Native & Bun Installations

Fred· AI Engineer & Developer Educator9 min read

Introduction

Need to uninstall Claude Code? Whether you're switching installation methods, fixing a broken install, or doing a complete cleanup, this guide covers every scenario. I'll show you how to completely remove Claude Code from Windows, macOS, and Linux—including all configuration files, cache data, and lingering binaries that might cause conflicts later.

Why You'd Want to Uninstall Claude Code

The most common reason to uninstall Claude Code is switching from npm or Homebrew to the native binary installation, which Anthropic now recommends for better stability and auto-updates. You might also be dealing with a broken installation where mixed package managers (like npm + native, or Bun + Homebrew) created conflicts, segmentation faults, or version detection issues. Sometimes you're just cleaning up after troubleshooting and need to remove multiple versions installed across different tools. And of course, you might simply be done using Claude Code and want a complete removal.

If you're uninstalling to fix issues rather than permanently remove the tool, I strongly recommend removing all installations before doing a fresh native binary install. Mixed installations are the root cause of most Claude Code problems, and a clean slate fixes 90% of weird bugs.

Quick Jump to Your Installation Method

This guide covers uninstalling the native binary, npm global packages, Homebrew installations on macOS, Bun installations, and Windows-specific removal for both PowerShell native installs and WSL setups. Jump to the section that matches how you originally installed Claude Code, or follow the "nuclear option" at the end to remove everything at once.

Uninstall the Native Binary

The native binary installer places Claude Code in ~/.claude/ or sometimes ~/.local/bin/. To remove it completely, delete the Claude directory and remove any binaries from your local bin folder. You'll also want to clean up the PATH entry in your shell configuration so your terminal doesn't try to find a command that no longer exists.

# Remove the Claude directory
rm -rf ~/.claude

# Remove from local bin if present
rm -f ~/.local/bin/claude

Next, open your shell configuration file and remove the PATH entry. For Bash users, that's ~/.bashrc, and for Zsh users it's ~/.zshrc. Look for a line that says export PATH="$HOME/.claude/bin:$PATH" or similar, and delete it. After saving the file, reload your shell with source ~/.bashrc or source ~/.zshrc so the changes take effect immediately.

Uninstall Claude Code Installed via npm

If you installed Claude Code globally using npm install -g @anthropic-ai/claude-code, uninstalling is straightforward with npm's global uninstall command. However, if you're using nvm to manage multiple Node.js versions, you need to uninstall Claude Code from each version separately because npm global packages are installed per Node version, not system-wide.

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

For nvm users, first list your installed Node versions with nvm list, then switch to each version and uninstall. For example, run nvm use 18 followed by the uninstall command, then nvm use 20 and uninstall again. Repeat this for every Node version where you might have installed Claude Code. After uninstalling, verify removal by running which claude—you should see nothing or "claude not found."

Uninstall Claude Code from Homebrew on macOS

Homebrew makes uninstalling straightforward, but it's worth running the cleanup command to remove cached files that can take up disk space or interfere with fresh installs later. The unlink command ensures any symlinks Homebrew created are also removed, though this usually happens automatically during uninstall.

# Uninstall the package
brew uninstall claude-code

# Clean up cached files
brew cleanup claude-code

# Remove any lingering symlinks
brew unlink claude-code 2>/dev/null

After uninstalling, Homebrew will remove the binary from /usr/local/bin/ or /opt/homebrew/bin/ depending on your system. You don't need to manually edit your PATH because Homebrew manages that automatically.

Uninstall Claude Code Installed with Bun

Bun's global uninstall command works similarly to npm, but Bun sometimes leaves the binary behind even after uninstalling the package. This is a known quirk with Bun's global installs, so you'll want to manually remove the binary from ~/.bun/bin/ to ensure it's completely gone.

# Uninstall the package
bun uninstall -g @anthropic-ai/claude-code

# Remove the binary manually (Bun sometimes leaves this)
rm -f ~/.bun/bin/claude

After removing the binary, verify removal with which claude to make sure your shell can't find the command anymore. If it still shows up, check for other installation locations like ~/.local/bin/claude or ~/.claude/bin/claude.

Uninstall Claude Code on Windows

Removing the PowerShell Native Installation

If you installed Claude Code using the PowerShell one-liner irm https://claude.ai/install.ps1 | iex, the installer placed files in your user profile directory. Removing them requires deleting the .claude folder and the binary from your local programs directory. You may also need to clean up your PATH environment variable manually.

# Remove the Claude directory
Remove-Item -Recurse -Force "$env:USERPROFILE\.claude"

# Remove from local bin if present
Remove-Item -Force "$env:LOCALAPPDATA\Programs\claude\claude.exe" -ErrorAction SilentlyContinue

To remove Claude from your PATH, open System Properties by searching for "environment variables" in the Start menu. Click "Environment Variables," find the "Path" variable under "User variables," and edit it to remove any entries containing .claude or claude. This prevents Windows from looking for a command that no longer exists.

Uninstalling from WSL (Windows Subsystem for Linux)

If you installed Claude Code inside WSL, you're running a Linux environment and should follow the Linux uninstall instructions for whichever method you used. Open your WSL terminal and use the native binary, npm, or Bun uninstall steps depending on how you originally installed it. WSL installations are completely separate from Windows installations, so removing Claude from Windows won't affect WSL and vice versa.

Removing npm Installation on Windows

Windows npm uninstalls work the same as Linux and macOS. Open PowerShell or Command Prompt and run the global uninstall command. If you're using nvm-windows, you'll need to uninstall from each Node version just like on other platforms.

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

Clean Up Configuration and Cache Files

After uninstalling Claude Code, configuration and cache files may still remain on your system. These don't take up much space, but they can interfere with fresh installs if you're planning to reinstall later. Removing them ensures you start with a completely clean slate.

On Linux and macOS, Claude Code stores config in ~/.claude-code, ~/.config/claude-code, and cache in ~/.cache/claude-code. macOS also uses ~/Library/Application Support/claude-code and ~/Library/Caches/claude-code. Remove all of these with the commands below.

# Remove all Claude Code config and cache
rm -rf ~/.claude-code
rm -rf ~/.config/claude-code
rm -rf ~/.cache/claude-code

# On macOS, also check Application Support
rm -rf ~/Library/Application\ Support/claude-code
rm -rf ~/Library/Caches/claude-code

On Windows, use PowerShell to remove the same directories from your user profile. The ErrorAction SilentlyContinue flag prevents errors if the directories don't exist.

Remove-Item -Recurse -Force "$env:APPDATA\claude-code" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\claude-code" -ErrorAction SilentlyContinue

Verify Claude Code Is Completely Removed

To confirm Claude Code is fully uninstalled, check that your shell can't find the claude command anymore. Run which claude, type -a claude, and command -v claude—all of these should return empty output or "not found." If any of them still show a path, that means there's a lingering installation you need to remove.

# Check if claude command exists
which claude
type -a claude
command -v claude

# All should return empty or "not found"

You can also manually check for leftover files in common installation locations. Run ls -la ~/.claude, ls -la ~/.local/bin/claude, and ls -la ~/.bun/bin/claude. If any of these return results, delete those files or directories with rm -rf.

Nuclear Option: Remove Everything at Once

If you want to guarantee a completely clean slate and don't care about being surgical, run every uninstall command at once. This brute-force approach removes Claude Code regardless of how it was installed, clears all config and cache files, and leaves nothing behind. It's the fastest way to prepare for a fresh install or ensure complete removal.

# Remove all package manager installations
npm uninstall -g @anthropic-ai/claude-code 2>/dev/null
bun uninstall -g @anthropic-ai/claude-code 2>/dev/null
brew uninstall claude-code 2>/dev/null

# Remove native binary
rm -rf ~/.claude
rm -f ~/.local/bin/claude
rm -f ~/.bun/bin/claude

# Remove all config and cache
rm -rf ~/.claude-code
rm -rf ~/.config/claude-code
rm -rf ~/.cache/claude-code

# Verify removal
which claude  # Should return nothing

The 2>/dev/null redirects errors to nowhere, so you won't see "not installed" messages for methods you didn't use. After running this, Claude Code is guaranteed to be completely removed from your system.

Ready to Reinstall Claude Code?

If you uninstalled to fix issues or switch installation methods, the native binary is now the recommended way to install Claude Code. It offers better stability, automatic updates, and avoids package manager conflicts entirely. Installation is a single command that handles everything for you.

curl -fsSL https://claude.ai/install.sh | bash

For complete setup instructions including authentication, troubleshooting with claude doctor, and fixing common PATH issues, see the Claude Code Installation Guide. That guide covers Windows PowerShell installation with irm https://claude.ai/install.ps1 | iex, npm setup, Alpine Linux dependencies, and how to resolve mixed installation problems.

Quick Reference

  • Remove native binary: rm -rf ~/.claude && rm -f ~/.local/bin/claude
  • Uninstall npm: npm uninstall -g @anthropic-ai/claude-code
  • Uninstall Homebrew: brew uninstall claude-code && brew cleanup claude-code
  • Uninstall Bun: bun uninstall -g @anthropic-ai/claude-code && rm -f ~/.bun/bin/claude
  • Windows PowerShell: Remove-Item -Recurse -Force "$env:USERPROFILE\.claude"
  • Verify removal: which claude (should return nothing)
  • Reinstall (recommended): curl -fsSL https://claude.ai/install.sh | bash
Fred

Fred

AUTHOR

Full-stack developer with 10+ years building production applications. I use Claude Code daily for development and know its strengths and limitations.

Need a developer who gets it?

POC builds, vibe-coded fixes, and real engineering. Let's talk.

Hire Me →