-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
62 lines (54 loc) · 1.53 KB
/
setup.sh
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
# Function to install Homebrew if it's not installed
install_homebrew() {
if ! command -v brew &> /dev/null; then
echo "Homebrew not found. Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo "Homebrew is already installed."
fi
}
# Function to check if an application exists on the system
check_app_exists() {
app_name=$1
# Convert the search term to a case-insensitive format and replace hyphens with spaces
search_name=$(echo "$app_name" | tr '[:upper:]' '[:lower:]' | tr '-' ' ')
if mdfind "kMDItemKind == 'Application'" | grep -i "$search_name.app" &> /dev/null; then
return 0
else
return 1
fi
}
# Function to install multiple applications
install_applications() {
APPLICATIONS=(
notion
clickup
slack
discord
arc
raycast
rectangle
)
echo "Installing applications..."
for app in "${APPLICATIONS[@]}"; do
if brew list --cask "$app" &> /dev/null || check_app_exists "$app"; then
echo "$app is already installed."
elif check_app_exists "$app"; then
echo "$app is already installed on the system."
else
echo "Installing $app..."
brew install --cask "$app"
fi
done
}
# Run the functions
install_homebrew
install_applications
# Close the terminal after installation
close_terminal() {
osascript -e 'tell application "Terminal" to close first window' & exit
}
close_terminal
# Additional configurations can go here
# Source the script to apply changes
source ~/.zshrc