Skip to content

Commit 9c862a6

Browse files
committed
feat: add uninstall script for manual installs
1 parent 65677f8 commit 9c862a6

3 files changed

Lines changed: 106 additions & 0 deletions

File tree

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,18 @@ Set `PREFIX` to install to `$PREFIX/bin/` directory. Defaults to `/usr/local`
5656
when run as root or `$HOME/.local` when run as a non-root user.
5757

5858
Set `VERSION` to install a specific version. Defaults to the latest version.
59+
Set `VERSION=prerelease` to install the latest prerelease build.
5960

6061
For example, to install version `v0.0.369` to a custom directory:
6162

6263
```bash
6364
curl -fsSL https://gh.io/copilot-install | VERSION="v0.0.369" PREFIX="$HOME/custom" bash
6465
```
6566

67+
If the install location is not already in your `PATH`, the script prompts you to
68+
add it to your shell profile. The install script does not modify your shell
69+
configuration unless you explicitly confirm it.
70+
6671
Install with [Homebrew](https://formulae.brew.sh/cask/copilot-cli) (macOS and Linux):
6772

6873
```bash
@@ -95,6 +100,41 @@ npm install -g @github/copilot
95100
npm install -g @github/copilot@prerelease
96101
```
97102

103+
### Uninstallation
104+
105+
If you installed with the install script on macOS or Linux, uninstall with:
106+
107+
```bash
108+
curl -fsSL https://gh.io/copilot-uninstall | bash
109+
```
110+
111+
Or:
112+
113+
```bash
114+
wget -qO- https://gh.io/copilot-uninstall | bash
115+
```
116+
117+
Use `| sudo bash` to remove `/usr/local/bin/copilot`, or set `PREFIX` to remove
118+
`$PREFIX/bin/copilot`.
119+
120+
The uninstall script only removes the installed `copilot` binary. If you
121+
previously added the install directory to your `PATH`, remove that shell profile
122+
entry manually if you no longer want it.
123+
124+
If you installed with another package manager, uninstall with the same tool:
125+
126+
```bash
127+
brew uninstall copilot-cli
128+
```
129+
130+
```bash
131+
winget uninstall GitHub.Copilot
132+
```
133+
134+
```bash
135+
npm uninstall -g @github/copilot
136+
```
137+
98138

99139
### Launching the CLI
100140

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## 1.0.14 - 2026-03-31
22

3+
- Add a companion uninstall script for curl/wget installs and document scripted uninstall behavior
34
- Images are correctly sent to Anthropic models when using BYOM
45
- Model picker selection correctly overrides the --model flag for the current session
56
- Terminal output no longer clears or jumps on error exit

uninstall.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# GitHub Copilot CLI Uninstallation Script
5+
# Usage: curl -fsSL https://gh.io/copilot-uninstall | bash
6+
# or: wget -qO- https://gh.io/copilot-uninstall | bash
7+
# Use | sudo bash to run as root and remove from /usr/local/bin
8+
# Export PREFIX to remove from $PREFIX/bin/ directory (default: /usr/local for
9+
# root, $HOME/.local for non-root), e.g., export PREFIX=$HOME/custom to remove
10+
# from $HOME/custom/bin
11+
12+
echo "Uninstalling GitHub Copilot CLI..."
13+
14+
# Detect platform
15+
case "$(uname -s || echo "")" in
16+
Darwin*|Linux*) ;;
17+
*)
18+
if command -v winget >/dev/null 2>&1; then
19+
echo "Windows detected. Uninstalling via winget..."
20+
winget uninstall GitHub.Copilot
21+
exit $?
22+
else
23+
echo "Error: Windows detected but winget not found. Please remove GitHub Copilot CLI using the package manager you installed it with." >&2
24+
exit 1
25+
fi
26+
;;
27+
esac
28+
29+
# Check if running as root, fallback to non-root
30+
if [ "$(id -u 2>/dev/null || echo 1)" -eq 0 ]; then
31+
PREFIX="${PREFIX:-/usr/local}"
32+
else
33+
PREFIX="${PREFIX:-$HOME/.local}"
34+
fi
35+
INSTALL_DIR="$PREFIX/bin"
36+
TARGET="$INSTALL_DIR/copilot"
37+
38+
if [ ! -e "$TARGET" ]; then
39+
echo "Notice: No copilot binary found at $TARGET."
40+
41+
if command -v copilot >/dev/null 2>&1; then
42+
FOUND_PATH="$(command -v copilot)"
43+
echo "Another copilot binary is still available at $FOUND_PATH."
44+
echo "If you installed it with Homebrew, npm, or another package manager, uninstall it with that tool."
45+
fi
46+
47+
exit 0
48+
fi
49+
50+
if [ ! -w "$TARGET" ] && [ "$(id -u 2>/dev/null || echo 1)" -ne 0 ]; then
51+
echo "Error: Could not remove $TARGET. You may not have write permissions." >&2
52+
echo "Try running this script with sudo or set PREFIX to the installation prefix used previously." >&2
53+
exit 1
54+
fi
55+
56+
rm -f "$TARGET"
57+
echo "✓ Removed $TARGET"
58+
59+
if [ -d "$INSTALL_DIR" ] && [ -z "$(ls -A "$INSTALL_DIR" 2>/dev/null)" ]; then
60+
rmdir "$INSTALL_DIR" 2>/dev/null || true
61+
fi
62+
63+
echo ""
64+
echo "Uninstall complete."
65+
echo "If you previously added $INSTALL_DIR to your PATH, you can remove that entry from your shell profile manually."

0 commit comments

Comments
 (0)