@@ -99,11 +99,47 @@ install_wasmtime() {
9999 echo " 🔧 Checking wasmtime..."
100100 if command -v wasmtime & > /dev/null; then
101101 echo " ✅ wasmtime already installed: $( wasmtime --version) "
102+ return 0
103+ fi
104+
105+ echo " ⬇️ Installing wasmtime..."
106+
107+ # Pinned version to avoid issues with dynamic version fetching
108+ # The wasmtime.dev/install.sh script can fail when GitHub API rate limits
109+ # cause the version to be parsed incorrectly (e.g., returning '{' as version)
110+ WASMTIME_VERSION=" 29.0.1"
111+
112+ # Detect platform
113+ case " $( uname -s) " in
114+ Linux)
115+ WASMTIME_ARCH=" x86_64-linux"
116+ ;;
117+ Darwin)
118+ if [ " $( uname -m) " = " arm64" ]; then
119+ WASMTIME_ARCH=" aarch64-macos"
120+ else
121+ WASMTIME_ARCH=" x86_64-macos"
122+ fi
123+ ;;
124+ * )
125+ echo " ❌ Unsupported platform: $( uname -s) "
126+ exit 1
127+ ;;
128+ esac
129+
130+ WASMTIME_URL=" https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION} /wasmtime-v${WASMTIME_VERSION} -${WASMTIME_ARCH} .tar.xz"
131+ WASMTIME_DIR=" $HOME /.wasmtime"
132+
133+ echo " Downloading from: $WASMTIME_URL "
134+ mkdir -p " $WASMTIME_DIR /bin"
135+ curl -L " $WASMTIME_URL " | tar -xJ --strip-components=1 -C " $WASMTIME_DIR "
136+ export PATH=" $WASMTIME_DIR /bin:$PATH "
137+
138+ if command -v wasmtime & > /dev/null; then
139+ echo " ✅ wasmtime installed successfully: $( wasmtime --version) "
102140 else
103- echo " ⬇️ Installing wasmtime..."
104- curl https://wasmtime.dev/install.sh -sSf | bash
105- export PATH=" $HOME /.wasmtime/bin:$PATH "
106- echo " ✅ wasmtime installed successfully"
141+ echo " ❌ Failed to install wasmtime"
142+ exit 1
107143 fi
108144 echo " "
109145}
0 commit comments