-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapps.sh
173 lines (154 loc) · 3.71 KB
/
apps.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
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#!/bin/bash
#
# Installation script for macOS
#
# This script installs Homebrew, ASDF (version manager), Ruby, Node.js, and various useful applications.
set -e # Exit immediately if any command fails
# Logging functions
echo_info() { echo "[INFO] $1"; }
echo_error() { echo "[ERROR] $1"; }
echo_success() { echo "[SUCCESS] $1"; }
# Install Homebrew if not installed
install_homebrew() {
echo_info "Checking and installing Homebrew..."
if ! command -v brew &>/dev/null; then
echo_info "Homebrew not found. Installing..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add Homebrew to the shell's PATH if not present
if ! grep -q 'brew shellenv' ~/.zshrc; then
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc
fi
eval "$(/opt/homebrew/bin/brew shellenv)"
else
echo_info "Homebrew is already installed."
fi
}
# Install ASDF if not installed
install_asdf() {
echo_info "Installing ASDF..."
if [ ! -d "$HOME/.asdf" ]; then
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.zshrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.zshrc
echo 'legacy_version_file = yes' >> ~/.asdfrc
source ~/.zshrc
else
echo_info "ASDF is already installed."
fi
}
# Install Ruby and Node.js via ASDF
install_ruby_nodejs() {
echo_info "Installing Ruby and Node.js via ASDF..."
asdf plugin-add ruby || echo_error "Ruby plugin already exists!"
asdf plugin-add nodejs || echo_error "Node.js plugin already exists!"
asdf install ruby 3.3.3
asdf global ruby 3.3.3
asdf install nodejs 18.17.0
asdf global nodejs 18.17.0
}
# Install dependencies and tools via Homebrew (using Brewfile)
install_brew_dependencies() {
echo_info "Installing dependencies and tools using Brewfile..."
# Create Brewfile if it doesn't exist
BREWFILE="$HOME/Brewfile"
if [ ! -f "$BREWFILE" ]; then
echo_info "Creating Brewfile..."
cat <<EOL > $BREWFILE
tap "homebrew/cask-fonts"
tap "homebrew/cask-versions"
tap "homebrew/command-not-found"
# Essential formulas
brew "curl"
brew "git"
brew "postgresql"
brew "zsh"
brew "gh"
brew "wget"
brew "powerlevel10k"
brew "coreutils"
brew "dockutil"
brew "autoconf"
brew "automake"
brew "brotli"
brew "c-ares"
brew "coreutils"
brew "gettext"
brew "gmp"
brew "icu4c"
brew "krb5"
brew "libevent"
brew "libidn2"
brew "libnghttp2"
brew "libssh2"
brew "libtool"
brew "libuv"
brew "libwebsockets"
brew "libyaml"
brew "lz4"
brew "m4"
brew "mosquitto"
brew "ncurses"
brew "openssl@3"
brew "pcre"
brew "pkg-config"
brew "pnpm"
brew "[email protected]"
brew "redis"
brew "sqlite"
brew "tree"
brew "unixodbc"
brew "xz"
# Applications via Cask
cask "alt-tab"
cask "arc"
cask "bitwarden"
cask "discord"
cask "displaylink"
cask "docker"
cask "dozer"
cask "font-jetbrains-mono"
cask "github"
cask "keepingyouawake"
cask "keka"
cask "maccy"
cask "obsidian"
cask "omnidisksweeper"
cask "pictogram"
cask "popsql"
cask "postman"
cask "raycast"
cask "rectangle"
cask "replacicon"
cask "soundsource"
cask "stats"
cask "steam"
cask "ticktick"
cask "visual-studio-code"
cask "warp"
cask "whatsapp"
EOL
fi
# Install dependencies from the Brewfile
brew bundle --file=$BREWFILE || echo_error "Failed to install dependencies from Brewfile."
}
# Main script execution
install_homebrew
brew update
brew upgrade
install_asdf
install_ruby_nodejs
gem update --system
gem install rails
rails -v
install_brew_dependencies
# Update and upgrade casks
echo_info "Updating and upgrading casks..."
brew update
brew upgrade --cask
# Perform cask upgrade (brew cu)
echo_info "Upgrading all casks..."
brew tap buo/cask-upgrade
brew update
brew cu
# Finishing
echo_success "Installation and setup completed successfully."