From a263da3e538008005951eaa0193f9e2b15de49ec Mon Sep 17 00:00:00 2001 From: gavrielc Date: Wed, 22 Apr 2026 09:17:19 +0300 Subject: [PATCH] feat(setup): prompt to install Homebrew on factory macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit install-node.sh and install-docker.sh both require brew on macOS. On a fresh Mac there's no brew, so the bootstrap spinner would bail with a cryptic "Homebrew not installed" error. Move the prompt to nanoclaw.sh as a pre-flight, so the user sees a clear ask — including the heads-up that Xcode Command Line Tools come along for the ride (~5-10 min) — before the spinner starts and brew's own sudo/CLT prompts appear. Co-Authored-By: Claude Opus 4.7 (1M context) --- nanoclaw.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/nanoclaw.sh b/nanoclaw.sh index e94e383fe..a1a22af73 100755 --- a/nanoclaw.sh +++ b/nanoclaw.sh @@ -126,6 +126,54 @@ write_header printf '\n %s%s\n' "$(bold 'Nano')" "$(brand_bold 'Claw')" printf ' %s\n\n' "$(dim 'Setting up your personal AI assistant')" +# ─── pre-flight: Homebrew on macOS ───────────────────────────────────── +# setup/install-node.sh and setup/install-docker.sh both require `brew` on +# macOS. On a factory Mac there's no brew, and those helpers would fail +# later inside the bootstrap spinner with a cryptic error. Prompt here, +# before the spinner starts, so the user knows what's about to happen and +# brew's own interactive sudo/CLT prompts stay readable. +if [ "$(uname -s)" = "Darwin" ] && ! command -v brew >/dev/null 2>&1; then + printf ' %s\n' \ + "$(dim "Homebrew isn't installed. NanoClaw uses it to install Node and Docker on your Mac.")" + printf ' %s\n\n' \ + "$(dim "This also installs Apple's Command Line Tools, which can take 5-10 minutes.")" + read -r -p " $(bold 'Install Homebrew now?') [Y/n] " BREW_ANS /dev/null 2>&1; then + printf '\n %s %s\n' "$(red '✗')" "Homebrew install didn't complete." + printf ' %s\n\n' \ + "$(dim 'Install manually from https://brew.sh and re-run: bash nanoclaw.sh')" + exit 1 + fi + printf '\n' + ;; + *) + printf '\n %s\n\n' \ + "$(dim 'NanoClaw needs Homebrew. Install it from https://brew.sh and re-run.')" + exit 1 + ;; + esac +fi + # ─── first step: install the basics (Node + pnpm + native modules) ───── BOOTSTRAP_RAW="${STEPS_DIR}/01-bootstrap.log"