Skip to content

Commit 75a5c56

Browse files
committed
fix(claude): retry with GitHub version if CDN times out
Native installer fetches version from GCS CDN which can timeout. Now retries with explicit version from GitHub releases API as fallback, bypassing the CDN version check that was timing out.
1 parent d02cf60 commit 75a5c56

1 file changed

Lines changed: 37 additions & 4 deletions

File tree

scripts/install_claude.sh

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,50 @@ get_current_version() {
1313
}
1414

1515
# Install via native installer (recommended)
16+
# Accepts optional version argument to skip CDN version fetch
1617
install_native() {
18+
local target_version="${1:-}"
1719
echo "[claude] Installing via native installer (recommended)..." >&2
1820

1921
if [ "$(uname)" = "Darwin" ] || [ "$(uname)" = "Linux" ]; then
2022
# macOS / Linux / WSL
23+
local installer_args=""
24+
if [ -n "$target_version" ]; then
25+
installer_args="$target_version"
26+
echo "[claude] Using version: $target_version" >&2
27+
fi
28+
2129
if command -v curl >/dev/null 2>&1; then
22-
curl -fsSL https://claude.ai/install.sh | bash
23-
return $?
30+
if curl -fsSL https://claude.ai/install.sh | bash -s -- $installer_args; then
31+
return 0
32+
fi
33+
# If failed and we didn't specify version, retry with known version from GitHub
34+
if [ -z "$target_version" ]; then
35+
echo "[claude] Installer failed, retrying with explicit version..." >&2
36+
local github_version
37+
github_version=$(get_latest_version)
38+
if [ -n "$github_version" ]; then
39+
echo "[claude] Using version from GitHub: $github_version" >&2
40+
curl -fsSL https://claude.ai/install.sh | bash -s -- "$github_version"
41+
return $?
42+
fi
43+
fi
44+
return 1
2445
elif command -v wget >/dev/null 2>&1; then
25-
wget -qO- https://claude.ai/install.sh | bash
26-
return $?
46+
if wget -qO- https://claude.ai/install.sh | bash -s -- $installer_args; then
47+
return 0
48+
fi
49+
if [ -z "$target_version" ]; then
50+
echo "[claude] Installer failed, retrying with explicit version..." >&2
51+
local github_version
52+
github_version=$(get_latest_version)
53+
if [ -n "$github_version" ]; then
54+
echo "[claude] Using version from GitHub: $github_version" >&2
55+
wget -qO- https://claude.ai/install.sh | bash -s -- "$github_version"
56+
return $?
57+
fi
58+
fi
59+
return 1
2760
fi
2861
fi
2962

0 commit comments

Comments
 (0)