Manual Upgrade and Uninstall Guide for AI Coding CLI Tools

    Learn how to manually upgrade and uninstall AI coding command-line tools in restricted or offline environments. This guide covers version checks, backups and rollback plans, file replacement, permission handling across platforms, download alternatives, residual cleanup, troubleshooting, and best practices for keeping toolchains reproducible.

    1. Why Manage Versions Manually

    Auto-update mechanisms in AI coding command-line tools are convenient, but they are often unavailable or risky in enterprise intranets, offline development machines, and CI build nodes. An automatic upgrade may introduce incompatible dependency changes that break existing scripts and automation pipelines. A standard manual upgrade and uninstall procedure is therefore part of a developer’s core engineering skills.

    Manual version management offers three key benefits:

    • Version control: you decide when to upgrade.
    • Rollback: you can quickly revert to a stable release when something goes wrong.
    • Reproducible environments: teams can standardize on one tool version and avoid “it works on my machine” problems.

    2. Preparation Before Upgrading

    2.1 Record the Current Version and Installation Path

    Always confirm the current state before upgrading; otherwise there is no way to roll back after a failure. Common commands:

    1. # Check the current version
    2. claude --version
    3. # Locate the real executable path (Linux/macOS)
    4. which claude
    5. readlink -f "$(which claude)"
    6. # Locate the executable in Windows PowerShell
    7. Get-Command claude | Select-Object -ExpandProperty Source

    Tools installed through package managers or scripts often use symlinks and shadow copies, so the path shown by which may only be a link while the real file lives elsewhere. Record three things: the installation directory, the version number, and the installation method.

    2.2 Backup and Rollback Plan

    An upgrade essentially replaces the executable, so the safest rollback approach is to save a copy of the old file before overwriting it:

    1. cp "$(which claude)" ./claude.bak.$(date +%Y%m%d)

    If the tool has a user configuration directory (usually a hidden folder in the home directory), an upgrade normally leaves the configuration untouched. However, when crossing major versions, back up the configuration files as well to prevent startup failures caused by configuration format changes.

    3. Full Manual Upgrade Procedure

    3.1 Obtain the Official Release Package

    Download the archive for your platform from the project’s official release page, and choose a build that matches your operating system and CPU architecture (for example, the x64 build for 64-bit Windows). Choosing the wrong architecture is one of the most common causes of failed upgrades; symptoms usually include an “unrecognized application” error at startup or missing dynamic libraries.

    3.2 Stop All Running Instances

    Before overwriting files, make sure no process is holding the target file. Otherwise you will get a “file in use” error, or the replacement will succeed while the old version keeps running. How to check:

    1. # Find processes using the file (Linux)
    2. lsof "$(which claude)"
    3. # Terminate leftover processes
    4. pkill -f claude
    5. # Find and terminate processes on Windows
    6. tasklist | findstr claude
    7. taskkill /IM claude.exe /F

    Besides terminal sessions, watch out for IDE plugin host processes, background resident services, and automation tasks that are currently running.

    3.3 Replace the File and Verify

    Extract the archive, copy the new executable into the installation directory to overwrite the old one, then verify the version. Verification should go beyond the version number: run a minimal functional check, such as printing the help output or performing a side-effect-free read-only operation, to confirm the binary is complete and usable.

    3.4 Permissions and Platform Differences

    • Linux/macOS: confirm execute permission after replacement, and retry after chmod +x.
    • Windows: if the installation directory is under a protected system path, perform the overwrite as an administrator.
    • Enterprise-managed endpoints: unsigned binaries may be blocked by security policies, requiring internal approval and allowlisting.

    4. Alternative Paths When Downloads Are Blocked

    When the official release site is unreliable, use one of three general approaches instead of depending on a single channel:

    1. Use network acceleration tools to improve access quality, enabling acceleration only for necessary domains so that a global proxy does not affect intranet services.
    2. Download through a mirror or proxy, then verify the file hash against the checksum published officially before using it.
    3. Download on a connected jump host and transfer the file to the target machine through an internal file service or object storage. This approach works best for offline environments.

    Whichever path you choose, follow the principle of “verify first, then replace” to avoid introducing a tampered binary.

    5. Uninstalling and Cleaning Up Residuals

    The hard part of uninstalling is not deleting files but cleaning up scattered residuals. A complete uninstall covers four locations:

    • The executable and its directory.
    • User-level configuration and cache directories (usually hidden folders in the home directory).
    • System-level PATH environment variables, aliases, and autocompletion scripts.
    • Scheduled tasks, startup items, and background service registrations.

    On Linux, a cleanup sequence like this can be used as a reference:

    1. which -a claude # Confirm whether multiple copies exist
    2. rm -f "$(which claude)" # Remove the main program
    3. rm -rf ~/.config/claude # Clean up configuration and cache (example path)

    After cleanup, reopen the terminal to confirm the command is no longer available, and check whether the package manager database still has a record. This avoids an inconsistent state where the files are deleted but the version manager still considers the tool installed.

    6. Common Issues and Troubleshooting

    Symptom Common Cause Resolution
    Version number unchanged Multiple copies exist or a symlink was not updated Use which -a to locate all paths and replace each one
    “File in use” message A background process is still running Terminate the process or restart and retry
    Crashes at startup Architecture mismatch or missing runtime libraries Switch to a build that matches the architecture
    Configuration no longer works Configuration format changed across major versions Restore from backup and consult the migration notes

    7. Best Practices

    Scripting the upgrade is key to reducing human error. A reusable upgrade script should include at least six stages: version recording, backup, process checks, replacement, verification, and automatic rollback on failure. It is also recommended that teams standardize a version baseline, document the version number in project documentation, and run the automated test suite after each upgrade to confirm the overall health of the toolchain.