-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·106 lines (93 loc) · 3.75 KB
/
setup.sh
File metadata and controls
executable file
·106 lines (93 loc) · 3.75 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
# Exit on any error and treat unset variables as an error
set -eu
# Check if uv is installed
echo ""
echo "====================================================================="
echo "Checking if uv is installed..."
if ! command -v uv &> /dev/null; then
echo "uv not found. Installing uv..."
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.cargo/bin:$PATH"
else
echo "uv is already installed."
fi
# Install tcl-tk first (required for tkinter)
echo ""
echo "====================================================================="
echo "Installing tcl-tk..."
if ! brew list tcl-tk &> /dev/null; then
brew install tcl-tk
else
echo "tcl-tk is already installed."
fi
# Install Python 3.12 and python-tk@3.12 via brew
echo ""
echo "====================================================================="
echo "Installing Python 3.12 and python-tk@3.12 via brew..."
if ! brew list python@3.12 &> /dev/null; then
brew install python@3.12
else
echo "Python 3.12 is already installed."
fi
if ! brew list python-tk@3.12 &> /dev/null; then
brew install python-tk@3.12
else
echo "python-tk@3.12 is already installed."
fi
# Create virtual environment if it doesn't exist
echo ""
echo "====================================================================="
echo "Checking if virtual environment exists..."
if [ ! -d ".venv" ]; then
echo "Virtual environment not found. Creating one with Python 3.12 (brew)..."
# Use the full path to brew's Python which should now have tkinter support
PYTHON_PATH="$(brew --prefix python@3.12)/libexec/bin/python"
uv venv --python "$PYTHON_PATH"
else
echo "Virtual environment already exists."
fi
# Install project dependencies
echo ""
echo "====================================================================="
echo "Installing project dependencies..."
uv sync
# Check if ffmpeg is already installed
if ! command -v ffmpeg &> /dev/null; then
echo "Installing ffmpeg..."
brew install ffmpeg
else
echo "ffmpeg is already installed."
fi
# Check if microphone permission is already granted
uv run src/check_mic_permission.py
# Check for Accessibility permission
echo ""
echo "====================================================================="
echo "Please enable Accessibility permissions for your Terminal app:"
echo "1. Open 'System Settings' > 'Privacy & Security' > 'Accessibility'."
echo "2. Click the '+' button and add your Terminal app."
echo "3. Enable the checkbox next to your Terminal app."
open "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility"
echo "Press Enter once you have granted Accessibility permissions."
read -p "Press Enter to continue..."
# Check for Input Monitoring permission
echo ""
echo "====================================================================="
echo "Please enable Input Monitoring permissions for your Terminal app:"
echo "1. Open 'System Settings' > 'Privacy & Security' > 'Input Monitoring'."
echo "2. Click the '+' button and add your Terminal app."
echo "3. Enable the checkbox next to your Terminal app."
open "x-apple.systempreferences:com.apple.preference.security?Privacy_ListenEvent"
echo "Press Enter once you have granted Input Monitoring permissions."
read -p "Press Enter to continue..."
# Check for Microphone permission
echo ""
echo "====================================================================="
echo "Please enable Microphone permissions for your Terminal app:"
echo "1. Open 'System Settings' > 'Privacy & Security' > 'Microphone'."
echo "3. Ensure that the checkbox next to your Terminal app is enabled."
open "x-apple.systempreferences:com.apple.preference.security?Privacy_Microphone"
echo "Press Enter once you have granted Microphone permissions."
read -p "Press Enter to continue..."
echo "Setup complete. The environment is ready to use."