SIGN IN SIGN UP

fix(utils): make install-minikube-cluster.sh work on macOS (#970)

* fix(utils): make install-minikube-cluster.sh work on macOS

Fixes #931.

The script previously assumed Linux throughout and failed on macOS in
three distinct ways:

1. **Minikube binary selection.** Unconditionally downloaded
   minikube-linux-amd64 even on Darwin. Also short-circuited on
   'minikube already on PATH' without checking the binary is executable,
   so a Linux ELF copied to /usr/local/bin/minikube would never get
   replaced. Now detects OS (uname -s) and arch (uname -m), downloads
   the matching minikube-{linux,darwin}-{amd64,arm64} release, and
   requires the existing binary to actually run before considering it
   installed.

2. **calculate_safe_memory.** Read /proc/meminfo, which doesn't exist
   on macOS. Now uses 'sysctl -n hw.memsize' on Darwin (with ~60%
   available estimate, since Docker Desktop's VM budget has no clean
   equivalent to MemAvailable) and keeps the existing /proc/meminfo
   path on Linux. cgroup-v2 detection stays Linux-only.

3. **systemctl restart docker / sudo sysctl fs.protected_regular=0.**
   Both Linux-only — systemctl isn't on macOS, and fs.protected_regular
   is a Linux sysctl. Now guarded on HOST_OS == linux, with a hint on
   macOS to restart Docker Desktop manually.

BPF section was already guarded on /proc/sys path existence, no change
needed there.

Signed-off-by: HumphreySun98 <humphreysun98@gmail.com>

* fix(utils): use curl -fLO so minikube download fails fast on HTTP errors

Without -f, curl saves the server's error page (e.g. a 404/500 HTML body)
to minikube-${HOST_OS}-${HOST_ARCH} and exits 0, so the script then tries
to install that HTML as the minikube binary. -f makes curl exit non-zero on
HTTP errors, letting set -e abort cleanly.

Addresses review feedback on #970.

Signed-off-by: HumphreySun98 <humphreysun98@gmail.com>

---------

Signed-off-by: HumphreySun98 <humphreysun98@gmail.com>
Co-authored-by: Rui Zhang <51696593+ruizhang0101@users.noreply.github.com>
H
Humphrey committed
5261497ed04f835fc54e596b1702631875d802bf
Parent: 094289c
Committed by GitHub <noreply@github.com> on 6/25/2026, 9:59:10 PM