-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
878 lines (737 loc) · 25 KB
/
install.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
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
#!/bin/sh
# Color Variables
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
# Ask for the administrator password upfront.
sudo -v
function checkMackup {
if [ -f "$HOME/.mackup.cfg" ] ; then
echo "No path specified for your app preference backup."
echo "You can create such a backup via mackup."
echo -e "${RED}Do you still want to proceed? ${NC}[y/N]"
read -n 1 -r
echo # (optional) move to a new line
if ! [[ $REPLY =~ ^[Yy]$ ]] ; then
exit 0
fi
fi
}
function setComputerSettings {
echo -e "${RED}Enter your computer name please?${NC}"
read cpname
echo -e "${RED}Please enter your name?${NC}"
read name
echo -e "${RED}Please enter your git email?${NC}"
read email
clear
sudo scutil --set ComputerName "$cpname"
sudo scutil --set HostName "$cpname"
sudo scutil --set LocalHostName "$cpname"
defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$cpname"
defaults write -g ApplePressAndHoldEnabled -bool false
defaults write com.apple.finder ShowPathbar -bool true
defaults write com.apple.finder ShowStatusBar -bool false
defaults write NSGlobalDomain KeyRepeat -int 0.02
defaults write NSGlobalDomain InitialKeyRepeat -int 12
chflags nohidden "$HOME/Library"
git config --global user.name "$name"
git config --global user.email "$email"
git config --global color.ui true
}
function setTrackpadPreferences {
# Trackpad: enable tap to click for this user and for the login screen
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
# Trackpad: map bottom right corner to right-click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1
defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true
# Disable “natural” (Lion-style) scrolling
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
}
function setLanguagePreferences {
# Set language and text formats
defaults write NSGlobalDomain AppleLanguages -array "de"
defaults write NSGlobalDomain AppleLocale -string "de_DE@currency=EUR"
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"
defaults write NSGlobalDomain AppleMetricUnits -bool true
# Set the timezone; see `sudo systemsetup -listtimezones` for other values
sudo systemsetup -settimezone "Europe/Berlin" > /dev/null
}
function setTypingPreferences {
# Disable automatic capitalization as it’s annoying when typing code
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
# Disable smart dashes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# Disable automatic period substitution as it’s annoying when typing code
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
# Disable smart quotes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
# Disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
}
function setScreenshotPreferences {
# 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"
# Disable shadow in screenshots
defaults write com.apple.screencapture disable-shadow -bool true
}
function setSystemDefaults {
# Disable the sound effects on boot
sudo nvram SystemAudioVolume=" "
# Save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
# Disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
# Require password immediately after sleep or screen saver begins
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
# 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
# Disable disk image verification
defaults write com.apple.frameworks.diskimages skip-verify -bool true
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
}
function setFinderDefaults {
# When performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# Automatically open a new Finder window when a volume is mounted
defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
# Use column list view in all Finder windows by default
defaults write com.apple.finder FXPreferredViewStyle -string "clmv"
}
function setDockPreferences {
#Set dock icon size to 50 pixels
defaults write com.apple.dock tilesize -int 50
# Show indicator lights for open applications in the Dock
defaults write com.apple.dock show-process-indicators -bool true
}
function setDesktopPreferences {
# Enable snap-to-grid for icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" "$HOME/Library/Preferences/com.apple.finder.plist"
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" "$HOME/Library/Preferences/com.apple.finder.plist"
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" "$HOME/Library/Preferences/com.apple.finder.plist"
# Disable Dashboard
defaults write com.apple.dashboard mcx-disabled -bool true
# Don’t show Dashboard as a Space
defaults write com.apple.dock dashboard-in-overlay -bool true
# Top right screen corner → Desktop
defaults write com.apple.dock wvous-tr-corner -int 4
defaults write com.apple.dock wvous-tr-modifier -int 0
}
function setMenubarPreferences {
defaults write com.apple.systemuiserver menuExtras '(
"/System/Library/CoreServices/Menu Extras/Clock.menu",
"/System/Library/CoreServices/Menu Extras/Battery.menu",
"/System/Library/CoreServices/Menu Extras/AirPort.menu",
"/System/Library/CoreServices/Menu Extras/Volume.menu"
)'
# Show battery percentage in menu bar
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.battery" -bool true
defaults write com.apple.menuextra.battery '{ ShowPercent = YES; }'
}
function setNightShiftPreferences {
#enable night shift from 22-07
CORE_BRIGHTNESS="/var/root/Library/Preferences/com.apple.CoreBrightness.plist"
ENABLE='{
CBBlueReductionStatus = {
AutoBlueReductionEnabled = 1;
BlueLightReductionDisableScheduleAlertCounter = 3;
BlueLightReductionSchedule = {
DayStartHour = 7;
DayStartMinute = 0;
NightStartHour = 22;
NightStartMinute = 0;
};
BlueReductionEnabled = 0;
BlueReductionMode = 1;
BlueReductionSunScheduleAllowed = 1;
Version = 1;
};
}'
sudo defaults write $CORE_BRIGHTNESS "CBUser-0" "$ENABLE"
sudo defaults write $CORE_BRIGHTNESS "CBUser-$(dscl . -read "$HOME" GeneratedUID | sed 's/GeneratedUID: //')" "$ENABLE"
}
function setSystemPreferences {
echo "Setting some preferences..."
setSystemDefaults
setTypingPreferences
setTrackpadPreferences
setLanguagePreferences
setScreenshotPreferences
setFinderDefaults
setDockPreferences
setMenubarPreferences
setNightShiftPreferences
}
function setSafariPreferences {
# Privacy: don’t send search queries to Apple
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
# Set Safari’s home page to `about:blank` for faster loading
defaults write com.apple.Safari HomePage -string "about:blank"
# Prevent Safari from opening ‘safe’ files automatically after downloading
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
# Hide Safari’s bookmarks bar by default
defaults write com.apple.Safari ShowFavoritesBar -bool false
# Hide Safari’s sidebar in Top Sites
defaults write com.apple.Safari ShowSidebarInTopSites -bool false
# Disable Safari’s thumbnail cache for History and Top Sites
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
# Enable Safari’s debug menu
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
# Make Safari’s search banners default to Contains instead of Starts With
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
# Enable the Develop menu and the Web Inspector in Safari
defaults write com.apple.Safari IncludeDevelopMenu -bool true
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true
# Add a context menu item for showing the Web Inspector in web views
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
# Enable continuous spellchecking
defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool true
# Disable auto-correct
defaults write com.apple.Safari WebAutomaticSpellingCorrectionEnabled -bool false
# Warn about fraudulent websites
defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true
# Block pop-up windows
defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false
# Enable “Do Not Track”
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true
# Update extensions automatically
defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true
}
function setMailPreferences {
# Copy email addresses as `[email protected]` instead of `Foo Bar <[email protected]>` in Mail.app
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
# Disable inline attachments (just show the icons)
defaults write com.apple.mail DisableInlineAttachmentViewing -bool true
# Disable automatic spell checking
defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled"
}
function setTerminalPreferences {
# Only use UTF-8 in Terminal.app
defaults write com.apple.terminal StringEncodings -array 4
# Enable Secure Keyboard Entry in Terminal.app
defaults write com.apple.terminal SecureKeyboardEntry -bool true
# Disable the annoying line marks
defaults write com.apple.Terminal ShowLineMarks -int 0
}
function setMacAppStorePreferences {
# Enable the automatic update check
defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true
# Check for software updates daily, not just once per week
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
# 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
# Turn on app auto-update
defaults write com.apple.commerce AutoUpdate -bool true
# Allow the App Store to reboot machine on macOS updates
defaults write com.apple.commerce AutoUpdateRestartRequired -bool true
}
function setPhotoPreferences {
# Prevent Photos from opening automatically when devices are plugged in
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
}
function setOtherPreferences {
# Use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -int 0
# Auto-play videos when opened with QuickTime Player
defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen -bool true
}
function killallApplicationsForPreferences {
for app in "cfprefsd" \
"Dock" \
"Finder" \
"Mail" \
"Photos" \
"Safari" \
"SystemUIServer" \
"Terminal"; do
killall "${app}" &> /dev/null
done
}
function installHomebrew {
# Install Homebrew
echo "Installing Homebrew"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
}
function installJSEnvironment {
clear
echo -e "${RED}Setup Javascript Development? ${NC}[y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# Install NVM
echo "Installing NVM"
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm so we dont have to reboot the terminal
#Installing Nodejs
echo "Installing Nodejs"
nvm install node
nvm use node
#Intalling yarn
echo "Installing yarn"
brew install yarn
#Installing watchman
echo "Installing watchman"
brew install watchman
#Installing react-native-cli
echo "Installing React-Native CLI"
npm install -g react-native-cli
fi
}
function installPythonEnvironment {
clear
echo -e "${RED}Install Python? ${NC}[y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# Install Python
brew install python
fi
}
function installRubyEnvironment {
clear
echo -e "${RED}Install Ruby?${NC} [y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# Install ruby with rvm and bundler
brew install gpg
command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
\curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm install ruby-2.3.1
gem install bundler
fi
}
function installiOSEnvironment {
clear
echo -e "${RED}Setup iOS Development?${NC} [y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo -e "Installing\n[+]cocoapods\n[+]carthage\n[+]fastlane\n[+]opensim\n[+]marathon\n[+]testdrive\n[+]swiftlint"
sudo gem install cocoapods
brew install \
carthage \
marathon-swift \
swiftlint
marathon install johnsundell/testdrive
brew cask install \
fastlane \
opensim
fi
}
function installJavaEnvironment {
clear
echo -e "${RED}Setup for Java Development? ${NC}[y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "Installing\n[+]Java\n[+]Eclipse"
brew cask install \
java \
eclipse-ide \
eclipse-java
fi
}
function installAndroidEnvironment {
clear
echo -e "${RED}Setup For Android Development?${NC} [y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo -e "Installing\n[+]Java\n[+]Eclipse\n[+]Android-Studio\n[+]IntelliJ IDEA Community Edition\n[+]gradle\n[+]Android-SDK"
brew cask install \
java \
eclipse-ide \
eclipse-java \
android-studio \
intellij-idea-ce
brew install gradle
brew install android-sdk
fi
}
function installDatabases {
clear
echo -e "${RED}Install Databases? ${NC}[y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo -e "Installing\n[+]MySQL\n[+]PostgreSQL\n[+]Mongo\n[+]DBeaver"
brew install mysql
brew install postgresql
brew install mongo
# Install DBeaver
# Install Cask
brew install caskroom/cask/brew-cask
brew cask install --appdir="/Applications" dbeaver-community
fi
}
function installCommandLineTools {
clear
# Install Homebrew Apps
echo "Installing Homebrew Command Line Tools"
echo -e "Installing\n[+]wget\n[+]micro\n[+]jid\n[+]vim\n[+]tldr\n[+]z\n[+]ag\n[+]oh-my-zsh"
brew install \
wget \
micro \
jid \
vim \
tldr \
z \
the_silver_searcher
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
}
function installCask {
brew tap caskroom/cask
brew tap caskroom/versions
brew tap homebrew/cask-fonts
}
function installOptionalApplications {
clear
echo -e "${RED}Install Kitematic? ${NC}[y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# Install Kitematic
brew cask install kitematic
fi
clear
echo -e "${RED}Install Franz? ${NC}[y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# Install Franz
brew cask install franz
fi
clear
echo -e "${RED}Install HexFiend? ${NC}[y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# Install HexFiend
brew cask install hex-fiend
fi
clear
echo -e "${RED}Install Iina? ${NC}[y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# Install Iina
brew cask install iina
fi
clear
echo -e "${RED}Install Fritzing? ${NC}[y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# Install Fritzing
brew cask install fritzing
fi
clear
echo -e "${RED}Install Resign? ${NC}[y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# Install Resign
git clone https://github.com/LigeiaRowena/Resign.git "Resign"
mv "./Resign/Resign.app" "/Applications/"
rm -Rf "Resign"
fi
clear
echo -e "${RED}Install Virtualbox? ${NC}[y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# Install Virtualbox
brew cask install virtualbox
brew cask install virtualbox-extension-pack
fi
clear
echo -e "${RED}Install Sketch? ${NC}[y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# Install Sketch
brew cask install sketch
fi
clear
echo -e "${RED}Install MacTeX & TeXMaker? ${NC}[y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# Install Tex Tools and Editor
brew cask install mactex
brew cask install texmaker
fi
}
function installMacAppStoreApps {
echo -e "${RED}Install some of your Mac App Store Apps? ${NC}[y/N]"
read -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
#Install mas
brew install mas
echo -e "Provide your Mac App Store email address"
read masEmail
echo # (optional) move to a new line
mas signin "$masEmail"
echo "Listing available Mac App Store apps: "
echo # (optional) move to a new line
mas list
echo # (optional) move to a new line
echo "Provide a comma separated list of ids of applications to install: "
read applicationIds
applicationIdsWithoutWhitespace=$(echo $applicationIds | tr -d ' ')
ids=$(echo $applicationIdsWithoutWhitespace | tr "," "\n")
for id in $ids
do
mas install "$id"
done
fi
}
function installApplications {
echo "Installing Apps"
echo -e "Installing\n[+]Google Chrome\n[+]Reggy\n[+]AppCleaner\n[+]Sublime Text\n[+]Dropbox\n[+]Tower Git\n[+]Charles Web Proxy\n[+]Dash\n[+]Hopper Disassembler & Debugger Server\n[+]Alfred 3\n[+]1Password\n[+]Visual Studio Code\n[+]Fantastical 2\n[+]Evernote\n[+]AppCode\n[+]Spotify\n[+]TeaCode\n[+]DevonThink Pro Office\n[+]WWDC"
brew cask install \
google-chrome \
paw \
reggy \
appcleaner \
dropbox \
tower \
charles \
dash \
hopper-disassembler \
hopper-debugger-server \
alfred \
1password \
visual-studio-code \
sublime-text \
fantastical \
evernote \
appcode \
spotify \
bettertouchtool \
devonthink-pro-office
curl -o "$HOME/TeaCode.zip" "https://www.apptorium.com/teacode/trial"
unzip "$HOME/TeaCode.zip"
mv "$HOME/TeaCode.app" "/Application/"
rm "$HOME/TeaCode.zip"
curl -o "$HOME/WWDC.zip" "https://github.com/insidegui/WWDC/releases/download/6.0.3/WWDC_v6.0.3.zip"
unzip "$HOME/WWDC.zip"
mv "$HOME/WWDC.app" "/Application/"
rm "$HOME/WWDC.zip"
}
function restoreMackupBackup {
if [ -f "$HOME/.mackup.cfg" ] ; then
echo "${RED}No backup path specified. Skipping this step.${NC}"
else
echo "Restoring some App Preferences from mackup"
git clone https://github.com/dehlen/mackup "$HOME/.mackup-master"
make -C "$HOME/.mackup-master"
mackup restore
fi
}
function installFonts {
echo "Installing Fonts"
fonts=(
font-hack
font-inconsolata
font-droid-sans-mono
font-droid-sans
font-source-code-pro
font-source-sans-pro
font-ubuntu
font-arvo
font-baumans
font-bowlby-one
font-bree-serif
font-cabin
font-cabin-condensed
font-cabin-sketch
font-comfortaa
font-droid-serif
font-fira-mono
font-fira-code
font-fira-sans
font-lato
font-lobster
font-montserrat
font-offside
font-open-sans
font-open-sans-condensed
font-paytone-one
font-titan-one
font-varela
)
brew cask install ${fonts[@]}
}
function installBashrc {
echo "Installing .bashrc"
echo "
. /usr/local/etc/profile.d/z.sh
export EDITOR='sublime'
alias subl='open -a /Applications/Sublime\ Text.app'
function h() {
if [ -z \"\$1\" ]
then
history
else
history | grep \"\$@\"
fi
}
alias ll='ls -la'
function find_dir {
find \"\$PWD\" -type d -name \"\$1\"
}
function find_file {
find \"\$PWD\" -type f -name \"\$1\"
}
function sublf() {
for i in \$(ag -l --hidden \"\$1\"); do subl \"\$i\"; done
}
" >> "$HOME/.bashrc"
}
function installBashProfile {
echo "Installing .bash_profile"
echo "
source ~/.bashrc
shopt -s histappend;
PS1='\[\033[1;36m\]\$: \[\033[0;33m\][\w]\[\033[0m\] → '
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad" >> "$HOME/.bash_profile"
}
function installVimConfiguration {
echo "Installing vim configuration"
git clone --depth=1 https://github.com/amix/vimrc.git "$HOME/.vim_runtime"
sh "$HOME/.vim_runtime/install_awesome_vimrc.sh"
echo "
set number
syntax enable
set background=dark
colorscheme solarized
let g:netrw_banner = 0
set clipboard=unnamed
" >> "$HOME/.vim_runtime/my_configs.vim"
}
function installZshConfiguration {
echo "Installing .zshrc"
echo "
export ZSH=/Users/dehlen/.oh-my-zsh
ZSH_THEME=\"dehlen\"
plugins=(
git
)
source \$ZSH/oh-my-zsh.sh
. /usr/local/etc/profile.d/z.sh
export EDITOR='sublime'
alias subl='open -a /Applications/Sublime\ Text.app'
function h() {
if [ -z \"\$1\" ]
then
history
else
history | grep \"\$@\"
fi
}
alias ll='ls -la'
function find_dir {
find \"\$PWD\" -type d -name \"\$1\"
}
function find_file {
find \"\$PWD\" -type f -name \"\$1\"
}
function sublf() {
for i in \$(ag -l --hidden \"\$1\"); do subl \"\$i\"; done
}
" >> "$HOME/.zshrc"
echo "Installing custom zsh theme"
echo "
PROMPT='%(?,%{\$fg[green]%},%{\$fg[green]%}) $ %{\$fg[blue]%}%~%{\$reset_color%} '
# RPS1='%{\$fg[blue]%}%~%{\$reset_color%} '
RPS1='%{\$fg[white]%}\$(git_prompt_info)%{\$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX=\" %{\$fg[yellow]%}(\"
ZSH_THEME_GIT_PROMPT_SUFFIX=\")%{\$reset_color%}\"
ZSH_THEME_GIT_PROMPT_CLEAN=\"\"
ZSH_THEME_GIT_PROMPT_DIRTY=\"%{\$fg[red]%} %{\$fg[yellow]%}*\"
" >> "$HOME/.oh-my-zsh/themes/dehlen.zsh-theme"
}
# Keep Sudo Until Script is finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Check if OSX Command line tools are installed
if type xcode-select >&- && xpath=$( xcode-select --print-path ) &&
test -d "${xpath}" && test -x "${xpath}" ; then
checkMackup
setComputerSettings
setSystemPreferences
setSafariPreferences
setMailPreferences
setTerminalPreferences
setPhotoPreferences
setOtherPreferences
echo "${GREEN}Done setting preferences."
echo "Note that some of these changes require a logout/restart to take effect."
installHomebrew
installJSEnvironment
installPythonEnvironment
installRubyEnvironment
installiOSEnvironment
installJavaEnvironment
installAndroidEnvironment
installDatabases
installCommandLineTools
installCask
installOptionalApplications
installMacAppStoreApps
installApplications
restoreMackupBackup
installFonts
installBashrc
installBashProfile
installVimConfiguration
installZshConfiguration
echo "Cleaning Up Cask Files"
brew cask cleanup
clear
echo "${GREEN}Done${NC}"
exit 0
else
echo "Need to install the OSX Command Line Tools (or XCode) First! Starting Install..."
echo "Start the script after the OSX Command Line Tools successfully installed once again."
# Install XCODE Command Line Tools
xcode-select --install
fi