forked from saroshaga/HostSwitch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_hostswitch.sh
More file actions
executable file
·38 lines (35 loc) · 1.29 KB
/
build_hostswitch.sh
File metadata and controls
executable file
·38 lines (35 loc) · 1.29 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
#!/bin/bash
# Build script for HostSwitch macOS Menu Bar app
echo "Building HostSwitch Menu Bar Utility..."
# Compile the Swift app
swiftc -parse-as-library -o HostSwitch.app/Contents/MacOS/HostSwitch main.swift HostSwitch.swift \
-framework SwiftUI \
-framework Foundation \
-framework AppKit \
-target x86_64-apple-macos11.0
if [ $? -eq 0 ]; then
echo "✅ Build successful!"
echo "📁 Menu bar app created at: HostSwitch.app"
echo ""
echo "To run the app:"
echo " open HostSwitch.app"
echo ""
echo "📋 Usage:"
echo " • The app will appear in your menu bar with a network icon"
echo " • Click the icon to view and toggle hosts entries"
echo " • Only manages entries in the dedicated section marked with:"
echo " ####### HostSwitchStart"
echo " ####### HostSwitchEnd"
echo ""
echo "🔒 Note: The app will request administrator privileges when modifying /etc/hosts"
echo " This is required by macOS for system file security"
echo ""
echo "📋 Usage:"
echo " 1. Click the network icon in your menu bar"
echo " 2. Toggle host entries on/off or add new ones"
echo " 3. Enter your password when prompted"
echo " 4. Changes are applied immediately"
else
echo "❌ Build failed!"
exit 1
fi