All three setup scripts (Linux, macOS, Windows) now verify that the Antigravity app is installed and the LS binary exists before proceeding. Fails early with a clear error message and suggestions instead of a cryptic runtime crash. Closes #5
94 lines
3.1 KiB
Bash
Executable File
94 lines
3.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# ZeroGravity — macOS setup
|
|
# Installs a launchd plist for automatic startup and sets up config directories.
|
|
# No UID isolation on macOS — runs in headless/HTTPS_PROXY mode only.
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
|
CONFIG_DIR="$HOME/Library/Application Support/zerogravity"
|
|
|
|
# ── 1. Config directory ──
|
|
echo "→ Setting up config directory…"
|
|
mkdir -p "$CONFIG_DIR"
|
|
|
|
# ── 2. Data directory ──
|
|
echo "→ Setting up /tmp/zerogravity-standalone…"
|
|
mkdir -p /tmp/zerogravity-standalone
|
|
|
|
# ── 3. Prerequisite check: Antigravity must be installed ──
|
|
LS_BINARY="${ZEROGRAVITY_LS_PATH:-}"
|
|
if [ -z "$LS_BINARY" ]; then
|
|
# Check both /Applications and ~/Applications
|
|
for base in "/Applications/Antigravity.app" "$HOME/Applications/Antigravity.app"; do
|
|
candidate="$base/Contents/Resources/app/extensions/antigravity/bin/language_server_darwin_arm64"
|
|
if [ -f "$candidate" ]; then
|
|
LS_BINARY="$candidate"
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
echo "→ Checking for Antigravity installation…"
|
|
if [ -z "$LS_BINARY" ] || [ ! -f "$LS_BINARY" ]; then
|
|
echo ""
|
|
echo "✗ Antigravity is not installed (or the LS binary is missing)."
|
|
echo " ZeroGravity requires a working Antigravity installation."
|
|
echo " The Language Server binary is bundled with the Antigravity app"
|
|
echo " and cannot be downloaded separately."
|
|
echo ""
|
|
echo " Expected in: /Applications/Antigravity.app or ~/Applications/Antigravity.app"
|
|
echo ""
|
|
echo " Install Antigravity first, then re-run this script."
|
|
echo " Alternatively, set ZEROGRAVITY_LS_PATH to a custom LS binary location."
|
|
exit 1
|
|
fi
|
|
echo " Found: $LS_BINARY"
|
|
|
|
# ── 4. Launchd plist ──
|
|
echo "→ Installing launchd plist…"
|
|
PLIST_DIR="$HOME/Library/LaunchAgents"
|
|
PLIST="$PLIST_DIR/com.zerogravity.proxy.plist"
|
|
mkdir -p "$PLIST_DIR"
|
|
cat > "$PLIST" << EOF
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>Label</key>
|
|
<string>com.zerogravity.proxy</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>$PROJECT_DIR/target/release/zerogravity</string>
|
|
</array>
|
|
<key>WorkingDirectory</key>
|
|
<string>$PROJECT_DIR</string>
|
|
<key>EnvironmentVariables</key>
|
|
<dict>
|
|
<key>RUST_LOG</key>
|
|
<string>info</string>
|
|
</dict>
|
|
<key>KeepAlive</key>
|
|
<dict>
|
|
<key>SuccessfulExit</key>
|
|
<false/>
|
|
</dict>
|
|
<key>StandardOutPath</key>
|
|
<string>$HOME/Library/Logs/zerogravity.log</string>
|
|
<key>StandardErrorPath</key>
|
|
<string>$HOME/Library/Logs/zerogravity.log</string>
|
|
</dict>
|
|
</plist>
|
|
EOF
|
|
echo " Installed: $PLIST"
|
|
echo " Start with: launchctl load $PLIST"
|
|
echo " Stop with: launchctl unload $PLIST"
|
|
|
|
# ── 5. Build ──
|
|
echo "→ Building release binary…"
|
|
cd "$PROJECT_DIR"
|
|
cargo build --release 2>&1 | tail -1
|
|
echo ""
|
|
echo "✓ Setup complete."
|
|
echo " Start with: launchctl load $PLIST"
|
|
echo " Or manually: zg start"
|