Files
unlimitedcoding/qwen/uqwen_uninstall.sh
delta-cloud-208e f7cf0b79fd docs: cross-platform install/update/uninstall instructions for codex/gemini/qwen
- Add Linux / macOS / Windows PowerShell / Windows CMD sections to all CLI READMEs
- Update product table versions (claude v2.1.112, codex v0.116.0, qwen v0.14.5)
- Make qwen install/update/uninstall scripts macOS-aware (sedi wrapper, launchctl, /Users scan, ~/.zshrc)
- Make gemini uninstall script macOS-aware (matching install/update)
- Fix CRLF line endings in qwen/gemini uninstall scripts

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 09:30:16 +00:00

116 lines
3.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Qwen Code — Uninstaller
# Removes Qwen Code CLI, settings, env vars, and npm registry config.
#
# Usage: sudo bash uqwen_uninstall.sh
set -euo pipefail
GREEN="\033[92m"
RED="\033[91m"
CYAN="\033[96m"
YELLOW="\033[93m"
BOLD="\033[1m"
RESET="\033[0m"
log() { echo -e "${GREEN}[+]${RESET} $*"; }
warn() { echo -e "${YELLOW}[~]${RESET} $*"; }
info() { echo -e "${CYAN}[i]${RESET} $*"; }
OS="$(uname -s)"
IS_MACOS=false
[ "$OS" = "Darwin" ] && IS_MACOS=true
sedi() {
if $IS_MACOS; then
sed -i '' "$@"
else
sed -i "$@"
fi
}
if $IS_MACOS; then
SCAN_DIRS="/Users"
else
SCAN_DIRS="/home"
fi
echo -e "${BOLD}"
echo " +--------------------------------------+"
echo " | Qwen Code — Uninstaller |"
echo " +--------------------------------------+"
echo -e "${RESET}"
# ---- Uninstall npm package ----
if npm list -g @qwen-code/qwen-code &>/dev/null 2>&1; then
info "Removing @qwen-code/qwen-code..."
npm uninstall -g @qwen-code/qwen-code 2>/dev/null || true
log "npm package removed"
else
warn "Qwen Code not found in npm global packages"
fi
# ---- Remove settings ----
for user_home in /root $SCAN_DIRS/*; do
QWEN_DIR="$user_home/.qwen"
if [ -d "$QWEN_DIR" ]; then
info "Removing $QWEN_DIR..."
rm -rf "$QWEN_DIR"
log "Removed $QWEN_DIR"
fi
done
# ---- Remove env vars from shell rc files ----
for user_home in /root $SCAN_DIRS/*; do
for rc_file in "$user_home/.bashrc" "$user_home/.zshrc"; do
if [ -f "$rc_file" ] && grep -q 'QWEN_API_KEY\|QWEN_BASE_URL\|Qwen Code\|Qwen env\|qwen-code-env' "$rc_file" 2>/dev/null; then
info "Cleaning env vars from $rc_file..."
sedi '/# Qwen Code/d' "$rc_file"
sedi '/# Qwen env/d' "$rc_file"
sedi '/qwen-code-env\.sh/d' "$rc_file"
sedi '/QWEN_API_KEY/d' "$rc_file"
sedi '/QWEN_BASE_URL/d' "$rc_file"
log "Cleaned $rc_file"
fi
done
done
# ---- Remove env files ----
for env_file in "/etc/profile.d/qwen-code.sh" "/etc/qwen-code-env.sh"; do
if [ -f "$env_file" ]; then
info "Removing $env_file..."
rm -f "$env_file"
log "Removed $env_file"
fi
done
# ---- Remove launchctl env vars (macOS) ----
if $IS_MACOS; then
launchctl unsetenv QWEN_API_KEY 2>/dev/null || true
launchctl unsetenv QWEN_BASE_URL 2>/dev/null || true
log "launchctl env vars cleared"
fi
# ---- Remove env vars from /etc/environment (Linux) ----
if [ -f "/etc/environment" ] && grep -q 'QWEN_API_KEY\|QWEN_BASE_URL' /etc/environment 2>/dev/null; then
info "Cleaning /etc/environment..."
sedi '/QWEN_API_KEY/d' /etc/environment
sedi '/QWEN_BASE_URL/d' /etc/environment
log "Cleaned /etc/environment"
fi
# ---- Remove npm registry config ----
info "Removing npm registry config..."
npm config delete @qwen-code:registry 2>/dev/null || true
log "npm registry config removed"
echo ""
echo -e "${GREEN}${BOLD} Qwen Code fully uninstalled!${RESET}"
echo ""