#!/bin/bash set -euo pipefail base_url="${1:?Usage: bash install.sh https://download-host/mcp [installer options]}" shift case "$base_url" in https://*) ;; *) echo 'HTTPS download URL required' >&2; exit 1;; esac if [ "$(uname -s)" != Darwin ]; then echo 'This installer requires macOS' >&2; exit 1; fi python_bin="${XAI_PYTHON:-python3}" "$python_bin" -c 'import sys; assert sys.version_info >= (3, 11), "Python 3.11+ required"' || { echo 'Install Python 3.11+ from python.org, then run again (Apple Silicon and Intel supported).' >&2 exit 1 } temporary="$(mktemp -d)" trap 'rm -f "$temporary/install.py"; rmdir "$temporary"' EXIT /usr/bin/curl -q --fail --silent --show-error --location --max-redirs 5 --connect-timeout 20 --max-time 180 --proto '=https' --proto-redir '=https' \ "$base_url/install-macos.py" -o "$temporary/install.py" "$python_bin" "$temporary/install.py" --base-url "$base_url" "$@"