#!/usr/bin/env bash set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" PLIST="$HOME/Library/LaunchAgents/ch.openkknd.autobuild.plist" mkdir -p "$HOME/Library/LaunchAgents" cat > "$PLIST" << PL Label ch.openkknd.autobuild ProgramArguments $ROOT/scripts/bump-and-build.sh StartInterval 14400 RunAtLoad StandardOutPath $ROOT/logs/launchd.out.log StandardErrorPath $ROOT/logs/launchd.err.log WorkingDirectory $ROOT PL launchctl bootout "gui/$(id -u)/ch.openkknd.autobuild" 2>/dev/null || true launchctl bootstrap "gui/$(id -u)" "$PLIST" launchctl enable "gui/$(id -u)/ch.openkknd.autobuild" 2>/dev/null || true echo "Installed $PLIST (every 14400s = 4h)"