diff --git a/README.md b/README.md index 347cf2dc..da7d9f09 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ Set `PREFIX` to install to `$PREFIX/bin/` directory. Defaults to `/usr/local` when run as root or `$HOME/.local` when run as a non-root user. Set `VERSION` to install a specific version. Defaults to the latest version. +Set `VERSION=prerelease` to install the latest prerelease build. For example, to install version `v0.0.369` to a custom directory: @@ -63,6 +64,10 @@ For example, to install version `v0.0.369` to a custom directory: curl -fsSL https://gh.io/copilot-install | VERSION="v0.0.369" PREFIX="$HOME/custom" bash ``` +If the install location is not already in your `PATH`, the script prompts you to +add it to your shell profile. The install script does not modify your shell +configuration unless you explicitly confirm it. + Install with [Homebrew](https://formulae.brew.sh/cask/copilot-cli) (macOS and Linux): ```bash @@ -95,6 +100,41 @@ npm install -g @github/copilot npm install -g @github/copilot@prerelease ``` +### Uninstallation + +If you installed with the install script on macOS or Linux, uninstall with: + +```bash +curl -fsSL https://raw.githubusercontent.com/github/copilot-cli/refs/heads/main/uninstall.sh | bash +``` + +Or: + +```bash +wget -qO- https://raw.githubusercontent.com/github/copilot-cli/refs/heads/main/uninstall.sh | bash +``` + +Use `| sudo bash` to remove `/usr/local/bin/copilot`, or set `PREFIX` to remove +`$PREFIX/bin/copilot`. + +The uninstall script only removes the installed `copilot` binary. If you +previously added the install directory to your `PATH`, remove that shell profile +entry manually if you no longer want it. + +If you installed with another package manager, uninstall with the same tool: + +```bash +brew uninstall copilot-cli +``` + +```bash +winget uninstall GitHub.Copilot +``` + +```bash +npm uninstall -g @github/copilot +``` + ### Launching the CLI diff --git a/changelog.md b/changelog.md index 2758725d..c168e006 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ ## 1.0.14 - 2026-03-31 +- Add a companion uninstall script for curl/wget installs and document scripted uninstall behavior - Images are correctly sent to Anthropic models when using BYOM - Model picker selection correctly overrides the --model flag for the current session - Terminal output no longer clears or jumps on error exit diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 00000000..3c4a22c3 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +set -e + +# GitHub Copilot CLI Uninstallation Script +# Usage: curl -fsSL https://gh.io/copilot-uninstall | bash +# or: wget -qO- https://gh.io/copilot-uninstall | bash +# Use | sudo bash to run as root and remove from /usr/local/bin +# Export PREFIX to remove from $PREFIX/bin/ directory (default: /usr/local for +# root, $HOME/.local for non-root), e.g., export PREFIX=$HOME/custom to remove +# from $HOME/custom/bin + +echo "Uninstalling GitHub Copilot CLI..." + +# Detect platform +case "$(uname -s || echo "")" in + Darwin*|Linux*) ;; + *) + if command -v winget >/dev/null 2>&1; then + echo "Windows detected. Uninstalling via winget..." + winget uninstall GitHub.Copilot + exit $? + else + echo "Error: Windows detected but winget not found. Please remove GitHub Copilot CLI using the package manager you installed it with." >&2 + exit 1 + fi + ;; +esac + +# Check if running as root, fallback to non-root +if [ "$(id -u 2>/dev/null || echo 1)" -eq 0 ]; then + PREFIX="${PREFIX:-/usr/local}" +else + PREFIX="${PREFIX:-$HOME/.local}" +fi +INSTALL_DIR="$PREFIX/bin" +TARGET="$INSTALL_DIR/copilot" + +if [ ! -e "$TARGET" ]; then + echo "Notice: No copilot binary found at $TARGET." + + if command -v copilot >/dev/null 2>&1; then + FOUND_PATH="$(command -v copilot)" + echo "Another copilot binary is still available at $FOUND_PATH." + echo "If you installed it with Homebrew, npm, or another package manager, uninstall it with that tool." + fi + + exit 0 +fi + +if [ ! -w "$TARGET" ] && [ "$(id -u 2>/dev/null || echo 1)" -ne 0 ]; then + echo "Error: Could not remove $TARGET. You may not have write permissions." >&2 + echo "Try running this script with sudo or set PREFIX to the installation prefix used previously." >&2 + exit 1 +fi + +rm -f "$TARGET" +echo "✓ Removed $TARGET" + +if [ -d "$INSTALL_DIR" ] && [ -z "$(ls -A "$INSTALL_DIR" 2>/dev/null)" ]; then + rmdir "$INSTALL_DIR" 2>/dev/null || true +fi + +echo "" +echo "Uninstall complete." +echo "If you previously added $INSTALL_DIR to your PATH, you can remove that entry from your shell profile manually."