forked from theavish/env-init
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sh
executable file
·503 lines (360 loc) · 14.8 KB
/
init.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
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# Ask for the administrator password upfront.
sudo -v
##########################
### Get info from user ###
##########################
computer_name=' '
user_name=' '
user_email=' '
echo -n "What would you like your computer to be known as on the network? ex:Joe's Macbook "
read computer_name
echo -n 'What is your git username? '
read user_name
echo -n 'What is your git email address? '
read user_email
#########################
### Install XCode CLI ###
#########################
if ! xcode-select --print-path &> /dev/null; then
# Prompt user to install the XCode Command Line Tools
xcode-select --install &> /dev/null
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Wait until the XCode Command Line Tools are installed
until xcode-select --print-path &> /dev/null; do
sleep 5
done
print_result $? 'Install XCode Command Line Tools'
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Point the `xcode-select` developer directory to
# the appropriate directory from within `Xcode.app`
# https://github.com/alrra/dotfiles/issues/13
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
print_result $? 'Make "xcode-select" developer directory point to Xcode'
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Prompt user to agree to the terms of the Xcode license
# https://github.com/alrra/dotfiles/issues/10
sudo xcodebuild -license
print_result $? 'Agree with the XCode Command Line Tools licence'
fi
#######################################
### Change ownership of /usr/local/ ###
#######################################
#echo '*** gaining ownership of /usr/local/ ***'
#sudo chmod a+w /usr/local/
# echo '*** creating code skeleton directory ***'
# mkdir -p $HOME/code/go/src/github.com/tylerferraro
##############################
### Software Installations ###
##############################
echo '*** install homebrew ***'
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# TODO Do we still need this?
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
#echo '*** install erlang ***'
#brew install erlang
#echo '*** install elixir ***'
#brew install elixir
echo '*** install git ***'
brew install git
#echo '*** install gnupg2 ***'
#brew install gnupg2
echo '*** install heroku ***'
brew install heroku
echo '*** install heroku-toolbelt ***'
brew install heroku-toolbelt
echo '*** install node/npm ***'
brew install node
brew install nvm
echo '*** install openssl ***'
brew install openssl
echo '*** install & start postgresql ***'
brew install postgresql
# brew install postgis
brew services start postgresql
echo '*** install & start redis ***'
brew install redis
brew services start redis
echo '*** install & start influxdb ***'
brew install influxdb
brew services start influxdb
echo '*** install s3cmd ***'
brew install s3cmd
echo '*** install tmux ***'
brew install tmux
echo '*** install tree ***'
brew install tree
#echo '*** install vim ***'
#brew install vim
echo '*** install wget ***'
brew install wget
echo '*** install imagemagick ***'
brew install imagemagick
brew install truncate
brew install git-when-merged
brew install markdown
echo '*** install hub` ***'
brew install hub
echo '*** install 1password ***'
brew install 1password
echo '*** install alfred ***'
brew install alfred
echo '*** install anvil ***'
brew install anvil
echo '*** install charles ***'
brew install charles
echo '*** install dash ***'
brew install dash
echo '*** install google chrome ***'
brew install google-chrome
# echo '*** install flux ***'
# brew install flux
# echo '*** install iterm2 ***'
# brew install iterm2
# echo '*** install mou ***'
# brew install mou
echo '*** install slack ***'
brew install slack
echo '*** install sketchup ***'
brew install sketchup
echo '*** install evernote ***'
brew install evernote
echo '*** install skitch ***'
brew install skitch
echo '*** install transmission ***'
brew install transmission
echo '*** install plex ***'
brew install plex-media-server
brew install plex-media-player
echo '*** install harvest ***'
brew install harvest
echo '*** install postman ***'
brew install postman
# echo '*** install meld ***'
# brew install meld
echo '*** install tableplus ***'
brew install tableplus
#echo '*** install skype ***'
#brew install skype
# echo '*** install synergy ***'
# brew install synergy
# echo '*** install vlc ***'
# brew install vlc
echo '*** install sublime text 3 ***'
brew install sublime-text
brew install sublime-merge
brew install amazon-music
brew install envkey
brew install zoom
brew install idagio
brew install google-cloud-sdk
brew install kubectl
brew install bash-completion@2
brew install jsonpp
echo ""
echo "****************************"
echo "NO INSTALLS FOR"
echo ""
echo "todoist"
echo "amphetamine"
echo "day one"
echo ""
echo "****************************"
echo ""
#########################
### Computer Settings ###
#########################
# Set computer name
echo '*** set computer name ***'
sudo scutil --set ComputerName $computer_name
sudo scutil --set HostName $computer_name
sudo scutil --set LocalHostName $computer_name
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string $computer_name
# Set standby delay to 12 hours
echo '*** set standby delay ***'
sudo pmset -a standbydelay 43200
# Disable the warning before emptying the Trash
echo '*** disable warning before emptying the trash ***'
defaults write com.apple.finder WarnOnEmptyTrash -bool false
# Show the ~/Library folder
echo '*** show the ~/Library folder ***'
chflags nohidden ~/Library
# Speed up Mission Control animations
echo '*** speed up mission control animations ***'
defaults write com.apple.dock expose-animation-duration -float 0.2
# Prevent Time Machine from prompting to use new hard drives as backup volume
echo '*** stop time machine from asking about new drives ***'
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# Disable Dashboard
#echo '*** disable dashboard ***'
#defaults write com.apple.dashboard mcx-disabled -bool true
# Make Dock icons of hidden applications translucent
echo '*** make hidden app icons translucent ***'
defaults write com.apple.dock showhidden -bool true
# Disable prompt when quitting iterm2
echo '*** Disable prompt when quitting iterm2 ***'
defaults write com.googlecode.iterm2 PromptOnQuit -bool false
# Don’t automatically rearrange Spaces based on most recent use
echo '*** stop automatically rearranging spaces based on time ***'
defaults write com.apple.dock mru-spaces -bool false
# Menu bar: hide the Time Machine and User icons
#echo '*** hide the time machine and user icons from the menu bar ***'
#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
# Set sidebar icon size to medium
echo '*** set sidebar icons in finder to medium size ***'
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2
# expand save prompt
echo '*** expand save prompt ***'
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
# quit printer app when there are no pending jobs
echo '*** quit printer app when there are no pending jobs ***'
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# save to disk instead of iCloud by default
echo '*** set default save location to disk instead of icloud ***'
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
# check for updates daily
echo '*** check for Apple updates daily ***'
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
# disable smart quotes, auto-correct spelling, and smart dashes
echo '*** disable smart quotes, auto-correct spelling, and smart dashes ***'
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# prevent Photos from opening when inserting external media
#echo '*** prevent photos from opening when instering drives ***'
#defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
# disable hibernate
echo '*** disable hibernate ***'
sudo pmset -a hibernatemode 0
# disable sudden motion sensor
echo '*** disable the sudden motion sensor ***'
sudo pmset -a sms 0
# increase Bluetooth sound quality
echo '*** increase bluetooth sound quality ***'
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
# disable press-and-hold for special keys
echo '*** disable special key press-and-hold ***'
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# disable auto-brightness on keyboard and screen
#echo '*** disable auto-brightness ***'
#sudo defaults write /Library/Preferences/com.apple.iokit.AmbientLightSensor "Automatic Keyboard Enabled" -bool false
#sudo defaults write /Library/Preferences/com.apple.iokit.AmbientLightSensor "Automatic Display Enabled" -bool false
# create folder for screenshots in documents
echo '*** create folder for screenshots in documents ***'
defaults write com.apple.screencapture location -string "${HOME}/Documents/screenshots"
# enable font rendering on non-apple displays
echo '*** enable font rendering on non-apple displays ***'
defaults write NSGlobalDomain AppleFontSmoothing -int 2
# show full path in finder
echo '*** show full path in finder ***'
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
# disable warning when changing file extension
echo '*** disable warning when changing file extension ***'
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# disable .DS_Store on network drives
echo '*** prevent creation of .DS_Store on network drives ***'
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# enable snap to grid for desktop and icon view
echo '*** enable snap to grid ***'
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
# set column view as default
echo '*** set column view as default in finder ***'
defaults write com.apple.finder FXPreferredViewStyle Clmv
# set dock icons to 48px
echo '*** set dock icons to 48px ***'
defaults write com.apple.dock tilesize -int 48
# disable focus ring
echo '*** disable focus ring ***'
defaults write NSGlobalDomain NSUseAnimatedFocusRing -bool false
# show battery percentage
echo '*** show battery percentage ***'
defaults write com.apple.menuextra.battery ShowPercent -string "YES"
#disable gatekeeper
echo '*** disable gatekeeper ***'
sudo spctl --master-disable
# disable npm progress bar (doubles install speed)
echo '*** disable npm progress bar ***'
npm set progress=false
# set tap-to-click
echo '*** enable tap-to-click ***'
defaults write com.apple.AppleMultitouchTrackpad Clicking -int 1
# change crash reporter to notification
echo '*** change crash reporter to notification ***'
defaults write com.apple.CrashReporter UseUNC 1
# create global .gitignore
echo '*** create global .gitignore ***'
curl -# https://raw.githubusercontent.com/denishaskin/env-init/master/assets/gitignore.txt > ~/.gitignore
# set git user info and credentials
echo '*** set git user info and credentials ***'
git config --global user.name $user_name
git config --global user.email $user_email
git config --global credential.helper osxkeychain
# update PATH
echo '*** update path ***'
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
# Disable local Time Machine snapshots
echo '*** disable local time machine snapshots ***'
sudo tmutil disablelocal
#############################
### Sublime Text Settings ###
#############################
# open sublime to initialize filepaths
echo '*** open sublime to initialize filepaths ***'
subl
# set vim as default text editor in git
echo '*** set sublime text as default text editor in git ***'
git config --global core.editor subl -nw
#set sublime as default text editor os-wide
echo '*** set sublime text as default text editor os-wide ***'
defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add \
'{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.3;}'
# set sublime packages
echo '*** set sublime packages ***'
curl -# https://raw.githubusercontent.com/denishaskin/env-init/master/assets/sublime-packages > /Users/$USER/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/Package\ Control.sublime-settings
# download sublime package manager
echo '*** download sublime package manager ***'
curl -# https://sublime.wbond.net/Package%20Control.sublime-package > /Users/$USER/Library/Application\ Support/Sublime\ Text\ 3/Installed\ Packages/Package\ Control.sublime-package
# set sublime settings
echo '*** set sublime preferences ***'
curl -# https://raw.githubusercontent.com/denishaskin/env-init/master/assets/sublime-preferences > /Users/$USER/Library/Application Support/Sublime Text 3/Packages/User/Preferences.sublime-settings
#######################
### install ohmyzsh ###
#######################
#echo '*** set vim config ***'
#curl -# https://raw.githubusercontent.com/tylerferraro/env-init/master/assets/vimrc > ~/.vimrc
echo '*** set ohmyzsh config ***'
curl -# https://raw.githubusercontent.com/denishaskin/env-init/master/assets/zshrc > ~/.zshrc
echo '*** set tmux config ***'
curl -# https://raw.githubusercontent.com/denishaskin/env-init/master/assets/tmux.conf > ~/.tmux.conf
echo '*** install rvm ***'
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable --rails
echo '*** generate ssh key ***'
ssh-keygen -t rsa -b 4096 -C "$user_email"
echo '*** adding generated key to agent ***'
ssh-add ~/.ssh/id_rsa
echo '*** install ohmyzsh ***'
sh -c "$(curl -#fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
############################
### install tmux plugins ###
############################
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
#########################
### set ohmyzsh theme ###
#########################
echo '*** set ohmyzsh theme ***'
curl -# https://raw.githubusercontent.com/denishaskin/env-init/master/assets/genzume.zsh-theme > ~/.oh-my-zsh/themes/genzume.zsh-theme
# TODO
# todoist
# remap Control-Shift-Down to not be Mission Control, or whatever it is
# My .gitconfig changes
# pex
# sublime text packages
# sublime text snippets
# dbvisualizer configuration