-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuninstall-launchagent.sh
More file actions
executable file
·43 lines (37 loc) · 1.22 KB
/
uninstall-launchagent.sh
File metadata and controls
executable file
·43 lines (37 loc) · 1.22 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
#!/bin/bash
PROJECT_DIR="$(cd "$(dirname "$0")" && pwd)"
PLIST_NAME="com.gemini-proxy.plist"
PLIST_LOCAL="${PROJECT_DIR}/${PLIST_NAME}"
PLIST_SYMLINK="${HOME}/Library/LaunchAgents/${PLIST_NAME}"
echo "Uninstalling gemini-proxy LaunchAgent..."
# Check if the service is running and unload it
if launchctl list | grep -q "com.gemini-proxy"; then
echo "Stopping service..."
launchctl unload "${PLIST_SYMLINK}" 2>/dev/null || true
echo "Service stopped"
else
echo "Service not currently running"
fi
# Remove the symlink
if [ -L "${PLIST_SYMLINK}" ]; then
rm "${PLIST_SYMLINK}"
echo "Removed symlink: ${PLIST_SYMLINK}"
elif [ -f "${PLIST_SYMLINK}" ]; then
# If it's a regular file (old installation), remove it
rm "${PLIST_SYMLINK}"
echo "Removed plist file: ${PLIST_SYMLINK}"
else
echo "Plist symlink/file not found: ${PLIST_SYMLINK}"
fi
# Optionally remove the local plist file
if [ -f "${PLIST_LOCAL}" ]; then
read -p "Remove local plist file? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm "${PLIST_LOCAL}"
echo "Removed local plist: ${PLIST_LOCAL}"
else
echo "Kept local plist: ${PLIST_LOCAL}"
fi
fi
echo "✅ LaunchAgent uninstalled successfully"