-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-mac.sh
385 lines (342 loc) · 9.86 KB
/
install-mac.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
#!/usr/bin/env bash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# install-mac.sh
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Variables
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ZSH=$HOME/.ohmyzsh;
ZSH_CUSTOM=$ZSH/custom;
DOTFILES=$ZSH_CUSTOM/plugins/dotfiles;
SITES=$HOME/Sites;
# Colors
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Regular
Blu='\e[0;34m';
# Bold
BGre='\e[1;32m';
BYel='\e[1;33m';
BWhi='\e[1;37m';
# No Color
NC='\e[0m'
# Helpers
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DIVIDER=`printf %81s |tr " " "="`;
__display_header() {
printf "\n${BYel}$DIVIDER\n${NC}"
printf "${BGre} $1\n${NC}"
printf "${BYel}$DIVIDER\n${NC}"
}
__display_message() {
printf "${Blu}==>${NC}${BWhi} $1\n${NC}";
}
__display_warn() {
printf "${Blu}==>${NC}${BYel} $1\n${NC}";
}
# Create directories arch
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__display_header "Creating directories arch";
if [[ ! -d $SITES ]]
then
mkdir -p $SITES;
__display_message "$SITES created";
else
__display_warn "$SITES already exists";
fi;
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Homebrew
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__display_header "Installing Homebrew"
if [[ ! -x "$(command -v brew)" ]];
then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)";
sudo chown -R $(whoami) $(brew --prefix)/*;
printf "${BGre}! Homebrew installed\n${NC}";
else
__display_warn "Homebrew already installed";
fi
# Homebrew Formulaes
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__display_header "Installing Formulaes"
if [[ ! -x "$(command -v emojify)" ]];
then
brew install emojify;
__display_message "emojify installed";
else
__display_warn "emojify already installed";
fi;
if [[ ! -x "$(command -v fzy)" ]];
then
brew install fzy;
__display_message "fzy installed";
else
__display_warn "fzy already installed";
fi;
if [[ ! -x "$(command -v htop)" ]];
then
brew install htop;
__display_message "htop installed";
else
__display_warn "htop already installed";
fi;
if [[ ! -x "$(command -v kubectx)" ]];
then
brew install kubectx;
__display_message "kubectx installed";
else
__display_warn "kubectx already installed";
fi;
if [[ ! -x "$(command -v tig)" ]];
then
brew install tig;
__display_message "tig installed";
else
__display_warn "tig already installed";
fi;
if [[ ! -x "$(command -v watch)" ]];
then
brew install watch;
__display_message "watch installed";
else
__display_warn "watch already installed";
fi;
if [[ ! -x "$(command -v lsd)" ]];
then
brew install lsd;
__display_message "lsd installed";
else
__display_warn "lsd already installed";
fi;
# Homebrew Casks
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__display_header "Installing Casks";
brew list appcleaner 2> /dev/null;
if [[ $? -eq 0 ]];
then
__display_warn "appcleaner already installed\n";
else
brew install --cask appcleaner;
__display_message "appcleaner installed\n";
fi;
brew list dbeaver-community 2> /dev/null;
if [[ $? -eq 0 ]];
then
__display_warn "dbeaver-community already installed\n";
else
brew install --cask dbeaver-community;
__display_message "dbeaver-community installed\n";
fi;
brew list docker 2> /dev/null;
if [[ $? -eq 0 ]];
then
__display_warn "docker already installed\n";
else
brew install --cask docker;
__display_message "docker installed\n";
fi;
brew list flutter 2> /dev/null;
if [[ $? -eq 0 ]];
then
__display_warn "flutter already installed\n";
else
brew install --cask flutter;
__display_message "flutter installed\n";
fi;
brew list memory-cleaner 2> /dev/null;
if [[ $? -eq 0 ]];
then
__display_warn "memory-cleaner already installed\n";
else
brew install --cask memory-cleaner;
__display_message "memory-cleaner installed\n";
fi;
brew list rar 2> /dev/null;
if [[ $? -eq 0 ]];
then
__display_warn "rar already installed\n";
else
brew install --cask rar;
__display_message "rar installed\n";
fi;
brew list rectangle 2> /dev/null;
if [[ $? -eq 0 ]];
then
__display_warn "rectangle already installed\n";
else
brew install --cask rectangle;
__display_message "rectangle installed\n";
fi;
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# dotfiles
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__display_header "Cloning dotfiles";
if [[ ! -d "$SITES/dotfiles" ]];
then
git clone git@github.com:juliogc/dotfiles.git "$SITES/dotfiles";
__display_message "dotfiles clonned";
else
__display_warn "dotfiles already clonned";
fi;
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# asdf
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__display_header "Installing asdf";
if [[ ! -d $HOME/.asdf ]];
then
git clone git@github.com:asdf-vm/asdf.git $HOME/.asdf;
source $HOME/.asdf/asdf.sh
__display_message "asdf installed";
else
__display_warn "asdf already installed";
fi;
# asdf plugins
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if [[ ! `asdf plugin list | grep nodejs` =~ nodejs ]];
then
asdf plugin add nodejs;
__display_message "nodejs installed";
else
__display_warn "nodejs already installed";
fi;
if [[ ! `asdf plugin list | grep java` =~ java ]];
then
asdf plugin add java;
__display_message "java installed";
else
__display_warn "java already installed";
fi;
if [[ ! `asdf plugin list | grep jq` =~ jq ]];
then
asdf plugin add jq;
__display_message "jq installed";
else
__display_warn "jq already installed";
fi;
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# oh-my-zsh
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__display_header "Installing oh-my-zsh";
if [[ ! -d $ZSH ]];
then
git clone git@github.com:ohmyzsh/ohmyzsh.git $ZSH;
__display_message "oh-my-zsh installed";
else
__display_warn "oh-my-zsh already installed";
fi;
# oh-my-zsh plugins
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__display_header "Installing oh-my-zsh plugins";
if [[ ! -d "$ZSH_CUSTOM/plugins/enhancd" ]];
then
git clone git@github.com:b4b4r07/enhancd.git "$ZSH_CUSTOM/plugins/enhancd";
__display_message "enhancd installed";
else
__display_warn "enhancd already installed";
fi;
if [[ ! -d "$ZSH_CUSTOM/plugins/zsh-better-npm-completion" ]];
then
git clone git@github.com:lukechilds/zsh-better-npm-completion.git "$ZSH_CUSTOM/plugins/zsh-better-npm-completion";
__display_message "zsh-better-npm-completion installed";
else
__display_warn "zsh-better-npm-completion already installed";
fi;
if [[ ! -d "$ZSH_CUSTOM/plugins/zsh-autosuggestions" ]];
then
git clone git@github.com:zsh-users/zsh-autosuggestions "$ZSH_CUSTOM/plugins/zsh-autosuggestions";
__display_message "zsh-autosuggestions installed";
else
__display_warn "zsh-autosuggestions already installed";
fi;
if [[ ! -d "$ZSH_CUSTOM/plugins/zsh-completions" ]];
then
git clone git@github.com:zsh-users/zsh-completions "$ZSH_CUSTOM/plugins/zsh-completions";
__display_message "zsh-completions installed";
else
__display_warn "zsh-completions already installed";
fi;
if [[ ! -d "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" ]];
then
git clone git@github.com:zsh-users/zsh-syntax-highlighting.git "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting";
__display_message "zsh-syntax-highlighting installed";
else
__display_warn "zsh-syntax-highlighting already installed";
fi;
if [[ ! -d "$ZSH_CUSTOM/plugins/dotfiles" ]];
then
ln -s "$SITES/dotfiles" "$ZSH_CUSTOM/plugins/dotfiles";
__display_message "dotfiles installed";
else
__display_warn "dotfiles already installed";
fi;
# oh-my-zsh themes
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__display_header "Installing oh-my-zsh themes";
if [[ ! -d "$ZSH_CUSTOM/themes/spaceship-prompt" ]];
then
git clone git@github.com:spaceship-prompt/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
__display_message "zsh-syntax-highlighting installed";
else
__display_warn "zsh-syntax-highlighting already installed";
fi;
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Create symlinks
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__display_header "Create symlinks"
if [[ ! -f $HOME/.zshrc ]]
then
ln -s $DOTFILES/.zshrc $HOME/.zshrc;
__display_message ".zshrc created";
else
__display_warn ".zshrc already exists";
fi;
if [[ ! -f $HOME/.gitignore ]];
then
ln -s $DOTFILES/.gitignore $HOME/.gitignore;
__display_message ".gitignore created";
else
__display_warn ".gitignore already exists";
fi;
if [[ ! -f $HOME/.gitconfig ]];
then
ln -s $DOTFILES/.gitconfig $HOME/.gitconfig;
__display_message ".gitconfig created";
else
__display_warn ".gitconfig already exists";
fi;
if [[ ! -d $HOME/.vim ]];
then
ln -s $DOTFILES/.vim $HOME/.vim;
__display_message ".vim created";
else
__display_warn ".vim already exists";
fi;
if [[ ! -f $HOME/.vimrc ]];
then
ln -s $DOTFILES/.vimrc $HOME/.vimrc;
__display_message ".vimrc created";
else
__display_warn ".vimrc already exists";
fi;
# [VIM] Install Vundle
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__display_header "Installing vundle";
if [[ ! -d $HOME/.vim/bundle/Vundle.vim ]]
then
git clone git@github.com:VundleVim/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim;
vim +PluginInstall +qall;
__display_message "vundle installed";
else
__display_warn "vundle already installed";
fi;