#!/usr/bin/env bash set -euo pipefail BINARY_URL="https://raw.githubusercontent.com/androidshashi/macdoctor/main/macdoctor" INSTALL_DIR="/usr/local/bin" BINARY_NAME="macdoctor" TMP_FILE="$(mktemp)" cleanup() { rm -f "$TMP_FILE" } trap cleanup EXIT # ── OS check ──────────────────────────────────────────────────────────────── if [ "$(uname -s)" != "Darwin" ]; then echo "❌ MacDoctor is macOS-only. Detected OS: $(uname -s)" exit 1 fi # ── Arch detection ─────────────────────────────────────────────────────────── ARCH="$(uname -m)" if [ "$ARCH" != "arm64" ] && [ "$ARCH" != "x86_64" ]; then echo "❌ Unsupported architecture: $ARCH" exit 1 fi echo "" echo "🩺 MacDoctor Installer" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo " Find what's secretly eating your Mac storage." echo " This will install 'macdoctor' to $INSTALL_DIR/$BINARY_NAME" echo "" # ── Confirmation ───────────────────────────────────────────────────────────── # Read from /dev/tty explicitly so this works when piped through: curl ... | bash read -r -p " Proceed with installation? [y/N] " CONFIRM