From 9dac5ba2e5340c510d14ae225015f549572e9803 Mon Sep 17 00:00:00 2001 From: Slava Date: Wed, 26 Nov 2025 19:36:53 +0100 Subject: [PATCH] Fix ARM64 detection on macOS with Rosetta 2 Adds sysctl hw.optional.arm64 check before uname -m checks to correctly detect Apple Silicon Macs even when shell runs under Rosetta 2 translation. Problem: uname -m returns x86_64 when terminal runs under Rosetta, causing installer to download x86_64 binaries instead of native arm64 binaries. Solution: Check sysctl hw.optional.arm64 on macOS first, which returns 1 on Apple Silicon regardless of Rosetta state. Tested: Correctly installs arm64 binaries on M2 Mac, no AVX warnings. --- scripts/install.sh.tmpl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/install.sh.tmpl b/scripts/install.sh.tmpl index 46120c2..4759f20 100755 --- a/scripts/install.sh.tmpl +++ b/scripts/install.sh.tmpl @@ -72,6 +72,9 @@ function install { ARCH="{{ .Arch }}" if [ -n "$ARCH" ]; then echo "Override architecture: $ARCH" + # Special handling for macOS - detect Apple Silicon even when running under Rosetta 2 + elif [[ $OS = "darwin" ]] && sysctl hw.optional.arm64 2>/dev/null | grep -q ': 1'; then + ARCH="arm64" elif uname -m | grep -E 'loong(arch)?64' > /dev/null; then ARCH="loong64" elif uname -m | grep -E '(aarch64|arm64)' > /dev/null; then