Manual Upgrade and Complete Uninstall Guide for AI Coding CLI Tools
Learn how to manually upgrade and completely uninstall AI coding command-line tools across enterprise networks, offline machines, and container build pipelines, including version checks, backup, atomic replacement, residual cleanup, and rollback practices.
1. Why Manual Upgrade and Clean Uninstall Matter
Automatic update mechanisms in AI coding CLI tools are convenient, but they often fail or become uncontrollable in enterprise intranets, offline development machines, and container image build pipelines. Automatic updates may be interrupted by network restrictions, missing proxy configuration, insufficient write permissions, or other factors, potentially leaving a tool in a half-upgraded state. The value of a manual upgrade is that the user retains full control over the timing of changes, the scope of changes, and the rollback path.
A clean uninstall is equally important. A CLI tool usually consists of more than a single executable. It may also leave configuration files, session history, caches, and logs in the user directory. If only the main program is removed, residual configuration may cause abnormal behavior after reinstallation—for example, it may still read an old model endpoint, reuse expired credentials, or load incompatible plugins.
This article does not target any specific vendor’s product. Instead, it abstracts a general methodology that applies to mainstream AI coding CLI tools. Different tools may vary slightly in file naming and directory layout, but the maintenance logic is consistent.
2. Preparation and Current State Check Before Upgrade
2.1 Record the Current Version and Installation Source
Before upgrading, confirm the current state so that you can roll back quickly if problems occur:
# Check the current versionclaude --version# Find the real path of the executable (Linux/macOS)which claudereadlink -f $(which claude)# Locate the executable path in Windows PowerShellGet-Command claude | Select-Object -ExpandProperty Source
Also record the installation method: a global npm package, a standalone executable, or a package managed by a package manager. Different sources correspond to different upgrade and uninstall paths. Mixing two installation methods is a major cause of version conflicts.
2.2 Back Up Configuration and Credentials
Before making changes, create a complete backup of the user-level configuration directory. A common practice is to package it into a timestamped archive and keep an additional copy in another location. Credential files contain sensitive information; after backup, check their permissions to prevent other users from reading them.
2.3 Confirm the Target Version and Verification Information
When downloading a new version archive from an official release channel, record both the version number and the checksum. After downloading, verify the hash to confirm that the file is complete and has not been tampered with:
sha256sum claude-win32-x64.zip # LinuxGet-FileHash .\claude-win32-x64.zip # Windows
3. Complete Manual Upgrade Process
3.1 Download and Extract
Find the archive for your platform on the official release page, download it, and extract it to a temporary directory to obtain the new executable. Do not place the temporary directory inside the installation directory; otherwise, extraction may overwrite files or leave extra files behind.
3.2 Stop All Running Instances
Before replacing the file, make sure no process is using the target file. Otherwise, you may get the illusion that “the replacement succeeded but the tool still runs the old version.” How to check:
# Linux/macOS: Find processes using the executableps -ef | grep -i claudelsof $(which claude)# Windows: View processes and command linestasklist | findstr /i claudewmic process where "name='claude.exe'" get ProcessId,CommandLine
In addition to terminal sessions, pay attention to IDE plugin host processes, background services, running build tasks, and CI agents. In containerized environments, confirm whether an old version is also built into the image.
3.3 Replacement and Permission Fix
Copy the new file into the installation directory and overwrite the old version, then check the executable permission and owner:
sudo cp /tmp/claude-new/claude /usr/local/bin/claudesudo chmod +x /usr/local/bin/claude
If the installation directory is managed by a package manager, directly overwriting it will break its integrity check. The next package manager operation may restore the old version. In this case, a more reliable approach is to install the new version into a separate directory and switch the target using a symbolic link, creating an atomic switch:
ln -sfn /opt/claude-tools/v1.2.3/claude /usr/local/bin/claude
The advantage of the symbolic link approach is that rollback is very cheap: just point the link back to the old directory.
3.4 Post-Upgrade Verification
Verification should cover three levels: version number, executability, and functional availability.
claude --version # Is the version number the target value?claude --help # Are all subcommands present?echo "hello" | claude -p "Summarize this text" # End-to-end connectivity
In enterprise environments, also verify whether proxy and certificate configurations are still effective, and whether any fields in the configuration file have been deprecated by the new version.
4. Complete Uninstall and Residual Cleanup
4.1 Three Layers of Uninstall
A complete uninstall requires layered handling: the program itself, user configuration and data, and environment variables and system integration.
Handle the program itself according to the installation method: delete a standalone executable directly; use the corresponding uninstall command for a package-manager installation; for a symbolic link installation, delete both the link and the target directory.
User data is usually located in hidden configuration directories, cache directories, and log directories under the user directory, and should be confirmed separately before deletion. If a multi-user shared host is involved, check each user directory for residuals.
System integration includes path additions, aliases, and completion scripts in shell startup scripts, as well as IDE plugins and global task configurations.
4.2 Post-Cleanup Confirmation
which claude # Should produce no outputenv | grep -i claude # Should show no related variablesls -a ~ | grep -i claude
Reopen the terminal and IDE in a clean environment and confirm that there are no errors and no automatic launch behavior. Only then is the uninstall considered complete.
5. General Approach for Restricted-Access Scenarios
When access to official release channels is unstable, you can solve the problem from three directions, none of which involves a specific tool:
- Use an enterprise internal artifact repository or mirror source to synchronize release packages, distribute them uniformly within the intranet, and balance compliance with speed;
- Download the package in an environment with network access, transfer it through an intranet file service or object storage, and then verify the hash on the target machine before use;
- Configure standard proxy environment variables and resolve enterprise self-signed certificate trust issues:
export HTTPS_PROXY=http://proxy.example.internal:8080export NODE_EXTRA_CA_CERTS=/etc/ssl/certs/corp-ca.pem
It is worth noting that acceleration and transfer only solve the problem of “obtaining the file.” Integrity and source trustworthiness still depend on hash verification and signature validation.
6. Common Issues and Best Practices
- Version number does not change: this is often because the process has not fully exited or because multiple executables exist. Use path queries to confirm which one is actually in effect.
- Configuration fails after upgrade: the new version may have changed the configuration structure. Read the release notes first and then migrate fields. Do not directly reuse the old file.
- Permission errors: the owner of the installation directory does not match the current user. Prefer adjusting the directory owner rather than loosening permission bits.
- Rollback plan: keep the old version directory and configuration backup, forming a dual-track structure of “new directory live, old directory on standby.”
- Automation: turn version checks, hash verification, replacement, and verification into scripts and incorporate them into configuration management to avoid manual omissions.
After mastering the above process, version evolution and retirement of AI coding CLI tools become controllable, auditable, and reproducible standard operations, significantly reducing maintenance risks in local development environments.
