#!/usr/bin/env bash # # bootstrap — one-time/local setup for Brew development. # # Safe to re-run: installs missing tooling and refreshes package resolution. set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$ROOT_DIR" echo "==> Checking Xcode Command Line Tools" if ! xcode-select -p >/dev/null 2>&1; then echo "Xcode Command Line Tools are required." echo "Run: xcode-select --install" echo "Then re-run: ./scripts/bootstrap" exit 1 fi echo "==> Checking Homebrew" if ! command -v brew >/dev/null 2>&1; then echo "Homebrew not found. Installing..." /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" fi # Ensure brew is available in this shell session (Apple Silicon or Intel). if [[ -x /opt/homebrew/bin/brew ]]; then eval "$(/opt/homebrew/bin/brew shellenv)" elif [[ -x /usr/local/bin/brew ]]; then eval "$(/usr/local/bin/brew shellenv)" fi echo "==> Installing tooling from Brewfile" brew bundle --file "$ROOT_DIR/Brewfile" if ! command -v mint >/dev/null 2>&1; then echo "mint not found after brew bundle. Check Brewfile and Homebrew setup." exit 1 fi echo "==> Installing Mintfile packages (SwiftFormat, SwiftLint)" mint bootstrap --mintfile "$ROOT_DIR/Mintfile" echo "==> Installing repository git hooks" "$ROOT_DIR/scripts/install-git-hooks" echo "==> Resolving Swift package dependencies" xcodebuild -resolvePackageDependencies -project "$ROOT_DIR/Homebrew.xcodeproj" # --------------------------------------------------------------------------- # Per-developer signing config # --------------------------------------------------------------------------- SIGNING_LOCAL="$ROOT_DIR/Configurations/Signing.local.xcconfig" SIGNING_EXAMPLE="$ROOT_DIR/Configurations/Signing.local.xcconfig.example" if [ ! -f "$SIGNING_LOCAL" ]; then cp "$SIGNING_EXAMPLE" "$SIGNING_LOCAL" echo "" echo "==> Created Configurations/Signing.local.xcconfig" echo " Open that file and replace YOUR_TEAM_ID_HERE with your" echo " 10-character Apple Team ID (Xcode → Settings → Accounts)." echo " Then open Homebrew.xcodeproj — signing will resolve automatically." else echo "==> Signing config already exists (Configurations/Signing.local.xcconfig)" fi echo "" echo "==> Bootstrap complete" echo "Next step: open Homebrew.xcodeproj"