Uninstallers (.sh + .ps1) for Claude, Gemini, Codex, Qwen: - Remove npm package / binary - Remove settings directory (~/.gemini, ~/.qwen, ~/.codex, ~/.claude) - Remove env vars from bashrc/zshrc, /etc/environment, /etc/profile.d - Remove npm registry config Also: restore defaultApprovalMode=yolo (npm package now includes Target 9a patch in settingsSchema.js) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
52 lines
1.9 KiB
PowerShell
52 lines
1.9 KiB
PowerShell
# Claude Code — Windows Uninstaller
|
|
# Usage: powershell -ExecutionPolicy Bypass -File claude\uclaude_uninstall.ps1
|
|
|
|
$ErrorActionPreference = "Continue"
|
|
|
|
Write-Host ""
|
|
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
|
|
Write-Host " | Claude Code -- Windows Uninstaller |" -ForegroundColor Cyan
|
|
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# ---- Uninstall npm package ----
|
|
|
|
Write-Host " Removing @anthropic-ai/claude-code..." -ForegroundColor Cyan
|
|
npm uninstall -g @anthropic-ai/claude-code 2>$null
|
|
Write-Host " npm package removed" -ForegroundColor Green
|
|
|
|
# ---- Remove settings ----
|
|
|
|
$claudeDir = "$env:USERPROFILE\.claude"
|
|
if (Test-Path $claudeDir) {
|
|
Write-Host " Removing $claudeDir..." -ForegroundColor Cyan
|
|
Remove-Item -Recurse -Force $claudeDir
|
|
Write-Host " Settings removed" -ForegroundColor Green
|
|
}
|
|
|
|
$claudeJson = "$env:USERPROFILE\.claude.json"
|
|
if (Test-Path $claudeJson) {
|
|
Remove-Item -Force $claudeJson
|
|
Write-Host " Removed .claude.json" -ForegroundColor Green
|
|
}
|
|
|
|
# ---- Remove env vars ----
|
|
|
|
Write-Host " Removing environment variables..." -ForegroundColor Cyan
|
|
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", $null, "User")
|
|
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", $null, "User")
|
|
[System.Environment]::SetEnvironmentVariable("CLAUDE_CODE_USE_BEDROCK", $null, "User")
|
|
Remove-Item Env:ANTHROPIC_API_KEY -ErrorAction SilentlyContinue
|
|
Remove-Item Env:ANTHROPIC_BASE_URL -ErrorAction SilentlyContinue
|
|
Write-Host " Env vars removed" -ForegroundColor Green
|
|
|
|
# ---- Remove npm registry config ----
|
|
|
|
Write-Host " Removing npm registry config..." -ForegroundColor Cyan
|
|
npm config delete "@anthropic-ai:registry" 2>$null
|
|
Write-Host " Registry config removed" -ForegroundColor Green
|
|
|
|
Write-Host ""
|
|
Write-Host " Claude Code fully uninstalled!" -ForegroundColor Green
|
|
Write-Host ""
|