#!/usr/bin/env bash # OPTIONAL (owner runs this by hand): keep MODELBEAST running across reboots # via a per-user LaunchAgent. Remove with: # launchctl bootout gui/$(id -u)/com.modelbeast.server # rm ~/Library/LaunchAgents/com.modelbeast.server.plist set -euo pipefail cd "$(dirname "$0")/.." ROOT=$(pwd) PLIST="$HOME/Library/LaunchAgents/com.modelbeast.server.plist" mkdir -p "$HOME/Library/LaunchAgents" "$ROOT/data" cat > "$PLIST" < Labelcom.modelbeast.server ProgramArguments /opt/homebrew/bin/uv runuvicornserver.main:app --host0.0.0.0 --port8777 WorkingDirectory$ROOT KeepAlive RunAtLoad StandardOutPath$ROOT/data/server.log StandardErrorPath$ROOT/data/server.log EOF launchctl bootout "gui/$(id -u)/com.modelbeast.server" 2>/dev/null || true launchctl bootstrap "gui/$(id -u)" "$PLIST" echo "LaunchAgent installed + started. Server will survive reboots."