-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
403 lines (324 loc) · 12.8 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
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
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
#!/bin/sh
echo "Mac OS Install Setup Script"
echo "By Eric Barb"
# Some configs reused from:
# https://github.com/nnja/new-computer
# https://github.com/ruyadorno/installme-osx/
# https://gist.github.com/millermedeiros/6615994
# https://gist.github.com/brandonb927/3195465/
# Colorize
# Set the colours you can use
black=$(tput setaf 0)
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
blue=$(tput setaf 4)
magenta=$(tput setaf 5)
cyan=$(tput setaf 6)
white=$(tput setaf 7)
# Resets the style
reset=`tput sgr0`
# Color-echo. Improved. [Thanks @joaocunha]
# arg $1 = message
# arg $2 = Color
cecho() {
echo "${2}${1}${reset}"
return
}
echo ""
cecho "###############################################" $red
cecho "# DO NOT RUN THIS SCRIPT BLINDLY #" $red
cecho "# YOU'LL PROBABLY REGRET IT... #" $red
cecho "# #" $red
cecho "# READ IT THOROUGHLY #" $red
cecho "# AND EDIT TO SUIT YOUR NEEDS #" $red
cecho "###############################################" $red
echo ""
# Set continue to false by default.
CONTINUE=false
echo ""
cecho "Have you read through the script you're about to run and " $red
cecho "understood that it will make changes to your computer? (y/n)" $red
read -r response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]; then
CONTINUE=true
fi
if ! $CONTINUE; then
# Check if we're continuing and output a message if not
cecho "Please go read the script, it only takes a few minutes" $red
exit
fi
# Here we go.. ask for the administrator password upfront and run a
# keep-alive to update existing `sudo` time stamp until script has finished
sudo -v
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
##############################
# Prerequisite: Install Brew #
##############################
echo "Installing brew..."
if test ! $(which brew)
then
## Don't prompt for confirmation when installing homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null
fi
# Latest brew, install brew cask
brew upgrade
brew update
brew tap caskroom/cask
#############################################
### Generate ssh keys & add to ssh-agent
### See: https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
#############################################
echo "Generating ssh keys, adding to ssh-agent..."
read -p 'Input email for ssh key: ' useremail
echo "Use default ssh file location, enter a passphrase: "
ssh-keygen -t rsa -b 4096 -C "$useremail" # will prompt for password
eval "$(ssh-agent -s)"
# Now that sshconfig is synced add key to ssh-agent and
# store passphrase in keychain
ssh-add -K ~/.ssh/id_rsa
# If you're using macOS Sierra 10.12.2 or later, you will need to modify your ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain.
if [ -e ~/.ssh/config ]
then
echo "ssh config already exists. Skipping adding osx specific settings... "
else
echo "Writing osx specific settings to ssh config... "
cat <<EOT >> ~/.ssh/config
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
EOT
fi
##############################
# Install via Brew #
##############################
echo "Starting brew app install..."
# Install Spectacle and set to run at login
brew cask install spectacle
defaults write com.divisiblebyzero.Spectacle StartAtLogin -bool true
# defaults write com.divisiblebyzero.Spectacle ShowPrefsOnNextStart -bool false
#PENDING - Replacement to Spectacle https://github.com/rxhanson/Rectangle
#brew cask install rectangle
brew cask install flux
brew cask install hyper
brew cask install iterm2
brew cask install docker
brew cask install vlc
brew cask install visual-studio-code
brew cask install google-chrome
brew cask install firefox
brew cask install brave-browser
brew cask install caffeine
#brew cask install google-backup-and-sync
brew cask install dotnet-sdk
brew cask install azure-data-studio
brew cask install microsoft-azure-storage-explorer
brew cask install postman
brew cask install powershell
brew cask install angry-ip-scanner
#PENDING- brew cask install insomnia
#PENDING- brew cask install alfred
# brew cask install filezilla #- Seems to be on the naughty list.
brew cask install figma
brew cask install kap
brew cask install spotify
brew cask install tor-browser
brew cask install tweeten
brew cask install wireshark
brew cask install openemu
brew cask install atom
brew cask install boostnote
brew cask install cloudapp
brew cask install now
brew cask install origin
brew cask install pgadmin4
brew cask install mongodb-compass-community
brew cask install mongotron
brew cask install sketch
brew cask install kitematic
brew cask install responsively
brew install git
brew install git-lfs
brew install wget
brew install curl
brew install zsh
brew install nvm
brew install zsh-completions
brew install tree
brew install azure-cli
brew install tmux
brew install mas
brew install go
brew install mkcert
brew install libdvdcss # Something for HandBrake
#brew install carthage
brew install --cask flutter
brew cask install virtualbox
# HashiCorp Stuff
brew tap hashicorp/tap
brew install hashicorp/tap/consul
brew install hashicorp/tap/packer
brew install hashicorp/tap/terraform
brew cask install vagrant
brew cast install vagrant-manager
### Run Brew Cleanup
echo "Cleaning up..."
brew cleanup
echo "Installing Azure Functions..."
brew tap azure/functions
brew install azure-functions-core-tools
#############################################
### Fonts
#############################################
echo "Installing fonts..."
brew tap caskroom/fonts
brew cask install font-fira-code
#############################################
### Installs from Mac App Store
#############################################
echo "Installing apps from the App Store..."
cecho "Need to log in to App Store manually to install apps with mas...." $red
echo "Opening App Store. Please login."
open "/Applications/App Store.app"
echo "Is app store login complete.(y/n)? "
read response
if [ "$response" != "${response#[Yy]}" ]
then
mas install 1295203466 # Microsoft Remote Desktop
mas install 404010395 # Text Wrangler
mas install 526298438 # Lightshot
mas install 823766827 # One Drive
mas install 1278508951 # Trello
mas install 871033113 # 2048
mas install 682658836 # GarageBand
mas install 497799835 # Xcode
mas install 803453959 # Slack
mas install 967004861 # HP Easy Scan
mas install 1037126344 # Apple Configurator 2
mas install 784801555 # Microsoft OneNote
# Apple Office Products
# mas install 409201541 # Pages
# mas install 409203825 # Numbers
# Microsoft Office Products
mas install 462058435 # Microsoft Excel
# mas install 985367838 # Microsoft Outlook
# mas install 462054704 # Microsoft Word
# mas install 462062816 # Microsoft Powerpoint
else
cecho "App Store login not complete. Skipping installing App Store Apps" $red
fi
#############################################
### Set OSX Preferences - Borrowed from https://github.com/mathiasbynens/dotfiles/blob/master/.macos
#############################################
# Close any open System Preferences panes, to prevent them from overriding settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
##############################
### Finder, Dock, & Menu Items
##############################
# Keep folders on top when sorting by name
defaults write com.apple.finder _FXSortFoldersFirst -bool true
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
# Save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
# Finder: show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# Disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
# Avoid creating .DS_Store files on network or USB volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
# Use list view in all Finder windows by default
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# Minimize windows into their application’s icon
defaults write com.apple.dock minimize-to-application -bool true
# Don’t show recent applications in Dock
defaults write com.apple.dock show-recents -bool false
# Menu bar: hide the Time Machine, User icons, but show the volume Icon.
# for domain in ~/Library/Preferences/ByHost/com.apple.systemuiserver.*; do
# defaults write "${domain}" dontAutoLoad -array \
# "/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \
# "/System/Library/CoreServices/Menu Extras/User.menu"
# done
# defaults write com.apple.systemuiserver menuExtras -array \
# "/System/Library/CoreServices/Menu Extras/Volume.menu" \
# "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" \
# "/System/Library/CoreServices/Menu Extras/AirPort.menu" \
# "/System/Library/CoreServices/Menu Extras/Battery.menu" \
# "/System/Library/CoreServices/Menu Extras/Clock.menu"
############################
### Text Editing / Keyboards
############################
# Disable smart quotes and smart dashes
# defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
# defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# Disable auto-correct
# defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# Use function F1, F, etc keys as standard function keys
# defaults write NSGlobalDomain com.apple.keyboard.fnState -bool true
###############################################################################
# Screenshots / Screen #
###############################################################################
# Save screenshots to the desktop
defaults write com.apple.screencapture location -string "$HOME/Desktop"
# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
defaults write com.apple.screencapture type -string "png"
###############################################################################
# Mac App Store #
###############################################################################
# Enable the automatic update check
defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true
# Download newly available updates in background
defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1
# Install System data files & security updates
defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1
###############################################################################
# Photos #
###############################################################################
# Prevent Photos from opening automatically when devices are plugged in
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
###############################################################################
# Google Chrome #
###############################################################################
# Disable the all too sensitive backswipe on trackpads
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
###########
# X Code
###########
if type xcode-select >&- && xpath=$( xcode-select --print-path ) &&
test -d "${xpath}" && test -x "${xpath}" ; then
echo "Xcode already installed. Skipping."
else
echo "Installing Xcode…"
xcode-select --install
echo "Xcode installed!"
fi
if [ ! -d "$HOME/.bin/" ]; then
mkdir "$HOME/.bin"
fi
echo "Updating default shell to ZSH"
chsh -s /bin/zsh
echo "Installing Oh-My-Zsh"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
echo ""
cecho "Done!" $cyan
echo ""
echo ""
cecho "################################################################################" $white
echo ""
echo ""
cecho "Note that some of these changes require a logout/restart to take effect." $red
echo ""
echo ""
echo -n "Check for and install available OSX updates, install, and automatically restart? (y/n)? "
read response
if [ "$response" != "${response#[Yy]}" ] ;then
softwareupdate -i -a --restart
fi