Skip to content

Commit 0ece67e

Browse files
AI Assistantclaude
andcommitted
fix(github-binary): clean up cargo and apt versions before installing
Problem: Tools installed via cargo or apt conflict with GitHub binaries - ripgrep 14.1.1 (cargo) at ~/.cargo/bin/rg - ripgrep 14.1.0 (apt) at /usr/bin/rg - Both block newer GitHub binary at ~/.local/bin/rg Solution: Automatically clean up alternative installations before installing Changes: - Remove cargo-installed binaries from ~/.cargo/bin before installing - Detect and remove apt-installed versions (requires sudo) - Ensures GitHub binary takes precedence in PATH This fixes cases where: - `make upgrade` installs new version but old version still executes - Multiple tool versions exist in different PATH locations - Users see "before: X, after: X" (no update) despite successful install Note: apt removal requires sudo and may fail silently if user doesn't have passwordless sudo. In that case, manual removal required: sudo apt remove <package-name> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e3bb4c2 commit 0ece67e

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

scripts/installers/github_release_binary.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,20 @@ if ! [ -s "$tmpfile" ]; then
9393
exit 1
9494
fi
9595

96+
# Clean up alternative installations (cargo, apt, brew) before installing
97+
if [ -f "$HOME/.cargo/bin/$BINARY_NAME" ]; then
98+
echo "[$TOOL] Removing cargo-installed version at ~/.cargo/bin/$BINARY_NAME" >&2
99+
rm -f "$HOME/.cargo/bin/$BINARY_NAME"
100+
fi
101+
102+
# Check if apt-installed and suggest removal
103+
if command -v dpkg >/dev/null 2>&1 && dpkg -S "/usr/bin/$BINARY_NAME" >/dev/null 2>&1; then
104+
PKG="$(dpkg -S "/usr/bin/$BINARY_NAME" | cut -d: -f1)"
105+
echo "[$TOOL] Note: apt-installed version found in package '$PKG'" >&2
106+
echo "[$TOOL] Removing apt package to prevent conflicts..." >&2
107+
apt_remove_if_present "$PKG" || true
108+
fi
109+
96110
# Install
97111
chmod +x "$tmpfile"
98112
$INSTALL -T "$tmpfile" "$BIN_DIR/$BINARY_NAME"

0 commit comments

Comments
 (0)