Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·51 lines (41 loc) · 1.58 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·51 lines (41 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Nap - AI Gateway with Auto Wake/Sleep
# Install script
set -e
PROJECT_DIR="$(cd "$(dirname "$0")" && pwd)"
PLIST_NAME="com.nap.ai.plist"
PLIST_SRC="$PROJECT_DIR/$PLIST_NAME"
PLIST_DST="$HOME/Library/LaunchAgents/$PLIST_NAME"
LOG_FILE="$HOME/Library/Logs/nap.log"
echo "🛠️ Installing Nap..."
# 1. Check for config
if [ ! -f "$PROJECT_DIR/config.yaml" ]; then
echo "⚠️ config.yaml not found!"
echo " Please copy config.example.yaml to config.yaml and fill in your details."
exit 1
fi
# 2. Install dependencies
echo "📦 Installing Python dependencies..."
python3 -m pip install --quiet PyYAML pyobjc-framework-Quartz rumps fastapi uvicorn requests
# 3. Make scripts executable
chmod +x "$PROJECT_DIR/nap.py"
chmod +x "$PROJECT_DIR/nap" 2>/dev/null || true
# 4. Create plist with correct path
echo "⚙️ Setting up launchd agent..."
sed "s|NAP_INSTALL_PATH|$PROJECT_DIR|g" "$PLIST_SRC" > "$PLIST_DST"
# 5. Update log path in plist
sed -i '' "s|/tmp/nap.log|$LOG_FILE|g" "$PLIST_DST"
# 6. Load the agent
launchctl unload "$PLIST_DST" 2>/dev/null || true
launchctl load "$PLIST_DST"
echo ""
echo "===================================================="
echo "✅ Nap is now running!"
echo "----------------------------------------------------"
echo "🤖 Menu Bar: Look for the 🤖 or 💤 icon"
echo "📂 Logs: tail -f $LOG_FILE"
echo "🌐 AI Gateway: http://localhost:11435"
echo "===================================================="
echo ""
echo "💡 Tip: Point your AI tools to http://localhost:11435"
echo " instead of your PC's IP for auto wake-on-demand."