#!/bin/sh # Umbra provider setup — turn an idle Apple Silicon Mac into a private # inference provider. Fetched from https://tryumbra.dev/install. # # This script does NOT install a prebuilt binary (none is published yet). # It checks your machine and prints the exact steps to build + run the # provider from source. Read it first — piping curl|sh always deserves a look. set -eu COORD_URL="https://api.tryumbra.dev" REPO_URL="https://github.com/owenisas/umbra" # ---- pretty output (no color if not a TTY) -------------------------------- if [ -t 1 ]; then B="$(printf '\033[1m')"; DIM="$(printf '\033[2m')"; R="$(printf '\033[0m')" GRN="$(printf '\033[32m')"; YEL="$(printf '\033[33m')"; RED="$(printf '\033[31m')" else B=""; DIM=""; R=""; GRN=""; YEL=""; RED="" fi say() { printf '%s\n' "$*"; } ok() { printf '%s\342\234\223%s %s\n' "$GRN" "$R" "$*"; } warn() { printf '%s!%s %s\n' "$YEL" "$R" "$*"; } err() { printf '%s\342\234\227%s %s\n' "$RED" "$R" "$*" 1>&2; } hr() { printf '%s--------------------------------------------------------%s\n' "$DIM" "$R"; } say "" say "${B}Umbra provider setup${R}" say "${DIM}private inference on idle Apple Silicon — build from source${R}" hr # ---- 1. OS + arch gate ---------------------------------------------------- OS="$(uname -s 2>/dev/null || echo unknown)" ARCH="$(uname -m 2>/dev/null || echo unknown)" if [ "$OS" != "Darwin" ]; then err "Umbra providers run on macOS only (this is $OS)." say " Apple Silicon + the Secure Enclave are required for the privacy" say " and attestation guarantees. Nothing to install here." exit 1 fi if [ "$ARCH" != "arm64" ]; then err "Apple Silicon (arm64) required — detected '$ARCH' (Intel is unsupported)." say " llama.cpp + the attestation path target arm64 Macs (M1 or newer)." exit 1 fi ok "macOS on Apple Silicon ($ARCH)" # Best-effort chip / macOS version (informational only). CHIP="$(sysctl -n machdep.cpu.brand_string 2>/dev/null || echo 'Apple Silicon')" MACOS="$(sw_vers -productVersion 2>/dev/null || echo '?')" say " ${DIM}${CHIP} · macOS ${MACOS}${R}" # ---- 2. prerequisites ----------------------------------------------------- hr say "${B}Checking prerequisites${R}" MISSING=0 if command -v git >/dev/null 2>&1; then ok "git" else warn "git not found — install Xcode Command Line Tools: xcode-select --install" MISSING=1 fi # Swift toolchain (ships with Xcode / CLT). 'swift --version' is the check. if command -v swift >/dev/null 2>&1; then SWIFT_V="$(swift --version 2>/dev/null | head -n1 || echo swift)" ok "swift ${DIM}(${SWIFT_V})${R}" else warn "swift not found — install Xcode (App Store) or: xcode-select --install" MISSING=1 fi # Hugging Face token — providers pull PUBLIC weights with their OWN HF key. if [ "${HF_TOKEN:-}" != "" ] || [ "${HUGGING_FACE_HUB_TOKEN:-}" != "" ]; then ok "Hugging Face token detected in environment" else warn "no HF_TOKEN in environment — you will need one to pull model weights" say " Create a read token at ${DIM}https://huggingface.co/settings/tokens${R}" fi # ---- 3. coordinator reachability (informational) -------------------------- hr say "${B}Coordinator${R} ${DIM}${COORD_URL}${R}" if command -v curl >/dev/null 2>&1; then if curl -fsS --max-time 6 "${COORD_URL}/v1/models" >/dev/null 2>&1; then ok "coordinator reachable (/v1/models answered)" else warn "could not reach ${COORD_URL}/v1/models right now (continuing anyway)" fi fi # ---- 4. next steps (the real, current path) ------------------------------- hr if [ "$MISSING" -ne 0 ]; then say "${YEL}Install the missing prerequisites above, then re-run this script.${R}" say "" fi say "${B}Build & run the provider from source:${R}" say "" say " ${B}1.${R} Clone the repo" say " git clone ${REPO_URL}.git" say " cd umbra/provider" say "" say " ${B}2.${R} Bootstrap the in-process llama.cpp engine (one time)" say " ../scripts/bootstrap-llama.sh" say " set -a; . ../.cache/llama-manifest.env; set +a" say "" say " ${B}3.${R} Export your Hugging Face read token" say " export HF_TOKEN=hf_xxxxxxxxxxxxxxxxxxxx" say "" say " ${B}4.${R} Point the provider at the coordinator" say " export UMBRA_COORD_URL=${COORD_URL}" say "" say " ${B}5.${R} Build" say " swift build -c release" say "" say " ${B}6.${R} Pick & approve a public HF model, then start serving" say " ${DIM}# follow umbra/provider/README.md for the onboarding flow:${R}" say " ${DIM}# choose model -> arch allowlist -> pull (your HF key) -> register + approve${R}" say "" hr say "Full guide: ${DIM}${REPO_URL}/blob/master/provider/README.md${R}" say "Become a provider / earnings: ${DIM}https://tryumbra.dev/become-a-provider${R}" say "" ok "Host check passed. No binary was installed (none is published yet) —" say " follow the steps above to build and run the provider from source." say "" exit 0