You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cd self-operating-computer || { log_error "Unable to navigate to the project directory.";exit 1; }
116
+
117
+
# Create a Python virtual environment
118
+
run_script "python3 -m venv venv"
119
+
120
+
# Activate the virtual environment
121
+
source venv/bin/activate || { log_error "Unable to activate the virtual environment.";exit 1; }
122
+
123
+
# Install project requirements
124
+
run_script "pip install -r requirements.txt"
125
+
126
+
# Install Project and Command-Line Interface
127
+
run_script "pip install ."
128
+
129
+
# Check if the .env file exists and the OPENAI_API_KEY is set in it
130
+
if [ -f .env ] && grep -q "OPENAI_API_KEY" .env;then
131
+
echo"OpenAI API key found in .env file. Skipping prompt..."
132
+
else
133
+
# Prompt user for Open AI key
134
+
read -p "Enter your OpenAI API key: " openai_key
135
+
136
+
# Set the API key as an environment variable
137
+
export OPENAI_API_KEY="$openai_key"
138
+
139
+
# Create a new .env file
140
+
touch .env
141
+
142
+
# Write the API key to the .env file
143
+
echo"OPENAI_API_KEY='$openai_key'"> .env
144
+
fi
145
+
146
+
# Notify the user about the last step
147
+
echo"Final Step: As a last step, the Terminal app will ask for permission for 'Screen Recording' and 'Accessibility' in the 'Security & Privacy' page of Mac's 'System Preferences.'"
148
+
149
+
echo"Operating system: $os"
150
+
151
+
if [ "$os"=="Darwin" ];then
152
+
echo"Attempting to open Security & Privacy settings..."
153
+
open /System/Library/PreferencePanes/Security.prefPane
154
+
read -p "Have you granted the necessary permissions in the Security & Privacy settings? (y/n): " confirm
155
+
if [ "$confirm"!="y" ];then
156
+
echo"Please grant the necessary permissions and then rerun the script."
157
+
exit 1
158
+
fi
159
+
else
160
+
echo"Not a macOS system, skipping..."
161
+
fi
162
+
163
+
# End of the script
164
+
echo"Installation complete. Enjoy using the Self-Operating Computer Framework!"
0 commit comments