forked from pal/mac-setup-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·295 lines (263 loc) · 5.73 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
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
#!/usr/bin/env bash
use_fish=true
use_bash=true
# sources for homebrew
taps=(
dart-lang/dart
github/gh
homebrew/bundle
homebrew/cask
homebrew/cask-fonts
homebrew/cask-versions
homebrew/core
)
# Install some stuff before others!
important_casks=(
1password
alfred
dropbox
google-chrome
tunnelblick
visual-studio-code
aws-vault
paw
)
casks=(
# evernote #MAS
# java
# steam #WIN
# telegram #MAS
# battlenet
# epic installer
# falcon-sql-client
# nosql-workbench-for-amazon-dynamodb
firefox
google-drive-file-stream
oracle-jdk
skype
slack
spotify
transmission
transmit
)
brews=(
amazon-workspaces
android-studio
awscli
bash
bash-completion@2
cocoapods
dart-lang/dart/dart
discord
fastlane
figma
fish
fzf
git
go
gradle
jq
logitech-presentation
mackup
mas
microsoft-teams
node
nvm
openjdk
openssl
python
python3
ruby
wget
yarn
zoomus
#Games
battle-net
epic-games
steam
)
mas=(
497799835 # Xcode (11.1)
405580712 # StuffIt Expander (15.0.7)
406056744 # Evernote (7.13)
407963104 # Pixelmator (3.8.6)
409183694 # Keynote (9.2)
409201541 # Pages (8.2)
409203825 # Numbers (6.2)
441258766 # Magnet (2.4.4)
747648890 # Telegram (5.7)
439623248 # iA Writer Classic
1470584107 # Dato
1294126402 # HEIC Converter
)
gems=(
bundler
)
npms=(
#@aws-amplify/[email protected]
#serverless
#sls-dev-tools
npx
standard
)
# not using this anymore, now syncing using VSCode and my Github account
vscode=(
adpyke.vscode-sql-formatter
bierner.github-markdown-preview
bierner.markdown-checkbox
bierner.markdown-emoji
bierner.markdown-preview-github-styles
bierner.markdown-yaml-preamble
blaxou.freezed
bungcip.better-toml
chenxsan.vscode-standardjs
Dart-Code.dart-code
Dart-Code.flutter
formulahendry.code-runner
golang.go
mathiasfrohlich.Kotlin
matt-meyers.vscode-dbml
mechatroner.rainbow-csv
Nash.awesome-flutter-snippets
redhat.vscode-yaml
skyapps.fish-vscode
ThreadHeap.serverless-ide-vscode
Tyriar.sort-lines
WallabyJs.quokka-vscode
)
git_configs=(
"branch.autoSetupRebase always"
"color.ui auto"
"core.autocrlf input"
"credential.helper osxkeychain"
"merge.ff false"
"pull.rebase true"
"push.default simple"
"rebase.autostash true"
"rerere.autoUpdate true"
"rerere.enabled true"
"user.email [email protected]"
"user.name Pål Brattberg"
)
fonts=(
font-asap
font-eb-garamond
font-fira-code
font-input
font-inter
font-open-sans
font-open-sans-condensed
font-source-code-pro
font-trebuchet-ms
)
######################################## End of app list ########################################
set +e
set -x
function prompt {
if [[ -z "${CI}" ]]; then
read -p "Hit Enter to $1 ..."
fi
}
function install {
cmd=$1
shift
for pkg in "$@";
do
exec="$cmd $pkg"
#prompt "Execute: $exec"
if ${exec} ; then
echo "Installed $pkg"
else
echo "Failed to execute: $exec"
if [[ ! -z "${CI}" ]]; then
exit 1
fi
fi
done
}
function brew_install_or_upgrade {
if brew ls --versions "$1" >/dev/null; then
if (brew outdated | grep "$1" > /dev/null); then
echo "Upgrading already installed package $1 ..."
brew upgrade "$1"
else
echo "Latest $1 is already installed"
fi
else
brew install "$1"
fi
}
if [[ -z "${CI}" ]]; then
sudo -v # Ask for the administrator password upfront
# Keep-alive: update existing `sudo` time stamp until script has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
fi
if test ! "$(command -v brew)"; then
prompt "Install Homebrew"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
if [[ -z "${CI}" ]]; then
prompt "Update Homebrew"
brew update
brew upgrade
brew doctor
fi
fi
export HOMEBREW_NO_AUTO_UPDATE=1
echo "Install important software ..."
install 'brew tap' "${taps[@]}"
install 'brew cask install' "${important_casks[@]}"
prompt "Install packages"
install 'brew install' "${brews[@]}"
#brew link --overwrite ruby
prompt "Set git defaults"
for config in "${git_configs[@]}"
do
git config --global ${config}
done
if [ "$use_bash" = true ]
then
prompt "Upgrade bash"
brew install bash bash-completion2 fzf
sudo bash -c "echo $(brew --prefix)/bin/bash >> /private/etc/shells"
#sudo chsh -s "$(brew --prefix)"/bin/bash
# Install https://github.com/twolfson/sexy-bash-prompt
touch ~/.bash_profile #see https://github.com/twolfson/sexy-bash-prompt/issues/51
(cd /tmp && git clone --depth 1 --config core.autocrlf=false https://github.com/twolfson/sexy-bash-prompt && cd sexy-bash-prompt && make install) && source ~/.bashrc
fi
if [ "$use_fish" = true ]
then
echo "Setting up fish shell ..."
brew install fish
echo $(which fish) | sudo tee -a /etc/shells
chsh -s $(which fish)
curl -L https://github.com/oh-my-fish/oh-my-fish/raw/master/bin/install | fish
install 'omf install' ${omfs[@]}
fi
echo "
alias del='mv -t ~/.Trash/'
alias ls='exa -l'
alias cat=bat
export EDITOR=code
" >> ~/.bash_profile
prompt "Install software"
install 'brew cask install' "${casks[@]}"
prompt "Install secondary packages"
install 'gem install' "${gems[@]}"
install 'npm install --global' "${npms[@]}"
install 'code --install-extension' "${vscode[@]}"
install 'brew cask install' "${fonts[@]}"
install 'mas install' "${mas[@]}"
if [[ -z "${CI}" ]]; then
prompt "Install software from App Store"
mas list
fi
prompt "Cleanup"
brew cleanup
brew cask cleanup
# Create my common folders
mkdir ~/dev
echo "Run [mackup restore] after DropBox has done syncing to get dotfiles"
echo "Run [git_setup.sh] to fetch all you need to start coding!"
echo "Done!"