-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgo.sh
More file actions
executable file
·1866 lines (1405 loc) · 74.1 KB
/
Copy pathgo.sh
File metadata and controls
executable file
·1866 lines (1405 loc) · 74.1 KB
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
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
#
# Description: Main Menu
#
# DESCRIPTION
# Executes the command line interface.
# USAGE
# ./go.sh OPTION
#--------------------------------------------------------------------
# Global Variables
#--------------------------------------------------------------------
datestamp=`date +"%Y%m%d"`
PIPLOC=/usr/local/Cellar/python/3.7.3/bin
#--------------------------------------------------------------------
# Parameters
#--------------------------------------------------------------------
function=$1
firstParameter=$2
secondParameter=$3
allParameters=${@:2}
#--------------------------------------------------------------------
# Colors
#--------------------------------------------------------------------
GREEN='\033[0;32m'
GRAY='\033[0;37m'
LIGHTBLUE='\033[1;34m'
LIGHTGREEN='\033[1;32m'
WHITEBOLD='\033[1;37m'
RED='\033[1;31m'
NC='\033[0m' # No Color
#--------------------------------------------------------------------
# Utilities
#--------------------------------------------------------------------
# Is the user running commands in sudo?
IS_SUDO=$(sudo -n uptime 2>&1|grep "load"|wc -l)
#--------------------------------------------------------------------
# Functions
#--------------------------------------------------------------------
xcode_install ()
{
# Ask for the administrator password upfront.
sudo -v
# Keep-alive: update existing `sudo` time stamp until the script has finished.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Installing the Xcode command line tools on 10.9.x or higher
osx_vers=$(sw_vers -productVersion | awk -F "." '{print $2}')
cmd_line_tools_temp_file="/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress"
# Installing the latest Xcode command line tools on 10.9.x or higher
echo " Scanning for OSX Version and Xcode command line tools version..."
if [[ "${osx_vers}" -ge 9 ]]; then
# Create the placeholder file which is checked by the softwareupdate tool
# before allowing the installation of the Xcode command line tools.
touch "${cmd_line_tools_temp_file}"
# Find the last listed update in the Software Update feed with "Command Line Tools" in the name
cmd_line_tools=$(softwareupdate -l | awk '/\*\ Command Line Tools/ { $1=$1;print }' | tail -1 | sed 's/^[[ \t]]*//;s/[[ \t]]*$//;s/*//' | cut -c 2-)
#Install the command line tools
softwareupdate -i "${cmd_line_tools}" -v
# Remove the temp file
if [[ -f "${cmd_line_tools_temp_file}" ]]; then
rm -v "${cmd_line_tools_temp_file}"
fi
fi
# End of Xcode command line tools check/install
#Remove All Unavailable Simulators
xcrun simctl delete unavailable
}
#--------------------------------------------------------------------
# go script commands list - all commands
#--------------------------------------------------------------------
if [[ "$function" == "list" || "$function" == "help" || "$function" == "" ]]; then
printf "\n${WHITEBOLD}Setup & Config: (go list:setup) \n"
printf "${LIGHTBLUE}go update${GRAY} : Install OS X software updates\n"
printf "${LIGHTBLUE}go defaults${GRAY} : Apply default system settings\n"
printf "${LIGHTBLUE}go install:ctags${GRAY} : Install ctags 5.8\n"
printf "${LIGHTBLUE}go install:brewpip${GRAY} : Install ALL Homebrew & PIP software\n"
printf "${LIGHTBLUE}go remove:brewpip${GRAY} : Remove ALL Homebrew & PIP software\n"
printf "${LIGHTBLUE}go update:brewpip${GRAY} : Update ALL Homebrew & PIP software\n"
printf "${LIGHTBLUE}go update:pihole${GRAY} : Update Pi-Hole software\n"
printf "${LIGHTBLUE}go install:software${GRAY} : Install necessary software\n"
printf "${LIGHTBLUE}go disable:callhome${GRAY} : Disable Apple Call Homes (custom)\n"
printf "${LIGHTBLUE}go enable:callhome${GRAY} : Enable Apple Call Homes (stock)\n"
printf "${LIGHTBLUE}go refresh:hosts${GRAY} : Refresh /etc/hosts file \n"
printf "\n${WHITEBOLD}General Utilities: (go list:general) \n"
printf "${LIGHTBLUE}go lock${GRAY} : Lock\n"
printf "${LIGHTBLUE}go restart${GRAY} : Restart OS X\n"
printf "${LIGHTBLUE}go sleep${GRAY} : Sleep mode\n"
printf "${LIGHTBLUE}go shutdown${GRAY} : Shutdown\n"
printf "${LIGHTBLUE}go time${GRAY} : Show clock at top right position in Terminal/iTerm\n"
printf "${LIGHTBLUE}go screensaver${GRAY} : Start screensaver\n"
printf "${LIGHTBLUE}go folders:list${GRAY} : List folders in current directory with their current size\n"
printf "${LIGHTBLUE}go folder:size${GRAY} : Calculate current folder size\n"
printf "${LIGHTBLUE}go folders:remove-empty${GRAY} : Remove empty subdirectories\n"
printf "${LIGHTBLUE}go apps:close-all${GRAY} : Close all opened apps\n"
printf "${LIGHTBLUE}go apps:app-store${GRAY} : Get list of installed apps from App Store\n"
printf "${LIGHTBLUE}go display:users${GRAY} : Display defined local accounts\n"
printf "${LIGHTBLUE}go display-all${GRAY} : Display mounted volumes and disks\n"
printf "${LIGHTBLUE}go eject-all${GRAY} : Eject all mounted volumes and disks\n"
printf "${LIGHTBLUE}go battery:status${GRAY} : Get battery information\n"
printf "${LIGHTBLUE}go info${GRAY} : Get OS X version information\n"
printf "${LIGHTBLUE}go find:text ${LIGHTGREEN}X${GRAY} : Find exact phrase recursively inside directory - ${LIGHTGREEN}X = Text string\n"
printf "${LIGHTBLUE}go find:biggest-files ${GRAY} : Find biggest files inside directory\n"
printf "${LIGHTBLUE}go find:biggest-directories ${GRAY} : Find biggest directories inside directory\n"
printf "${LIGHTBLUE}go zip:extract ${LIGHTGREEN}X${GRAY} : Extract Zip file to current folder - ${LIGHTGREEN}X = Zip file to extract\n"
printf "${LIGHTBLUE}go gzip:compress ${LIGHTGREEN}X${GRAY} : Compress current file using Gzip - ${LIGHTGREEN}X = File to compress\n"
printf "${LIGHTBLUE}go gzip:extract ${LIGHTGREEN}X${GRAY} : Extract Gzip file to current folder - ${LIGHTGREEN}X = Gzip file to extract\n"
printf "${LIGHTBLUE}go tar:compress ${LIGHTGREEN}X${GRAY} : Compress X file/directory using tar with progress indicator - ${LIGHTGREEN}X = File or directory\n"
printf "${LIGHTBLUE}go tar:extract ${LIGHTGREEN}X${GRAY} : Extract tar file to current folder - ${LIGHTGREEN}X = Tar file to extract\n"
printf "${LIGHTBLUE}go getwifipw${GRAY} : Determine SSID & Password\n"
printf "${LIGHTBLUE}go spacedock${GRAY} : Create Space In Dock\n"
printf "${LIGHTBLUE}go smallspacedock${GRAY} : Create Small Space In Dock\n"
printf "${LIGHTBLUE}go turnindexingoff${GRAY} : Turn Indexing Off\n"
printf "${LIGHTBLUE}go turnindexingon${GRAY} : Turn Indexing On\n"
printf "${LIGHTBLUE}go airplane-mode:status${GRAY} : Check Airplane Status\n"
printf "${LIGHTBLUE}go airplane-mode:on${GRAY} : Enable Airplane Mode\n"
printf "${LIGHTBLUE}go airplane-mode:off${GRAY} : Disable Airplane Mode\n"
printf "\n${WHITEBOLD}Time Machine: (go list:tm) \n"
printf "${LIGHTBLUE}go tmenable${GRAY} : Enable Local Time Machine Backups\n"
printf "${LIGHTBLUE}go tmdisable${GRAY} : Disable Local Time Machine Backups\n"
printf "${LIGHTBLUE}go tmdisablebattery${GRAY} : Disable Local Time Machine Backups While on Battery\n"
printf "${LIGHTBLUE}go tmlatest${GRAY} : Display Latest Time Machine Backup\n"
printf "${LIGHTBLUE}go tmlist${GRAY} : Display Full List of Time Machine Backups\n"
printf "\n${WHITEBOLD}Search Utilities: (go list:search) \n"
printf "${LIGHTBLUE}go find:recent ${LIGHTGREEN}X${GRAY} : Find files modified in the last N minutes - ${LIGHTGREEN}X = number of minutes \n"
printf "${LIGHTBLUE}go search:replace ${LIGHTGREEN}X${GRAY} : Search and replace string in file - ${LIGHTGREEN}X = File to perform the search and replace operation\n"
printf "\n${WHITEBOLD}Network Utilities: (go list:network) \n"
printf "${LIGHTBLUE}go speedtest${GRAY} : Internet connection speed test \n"
printf "${LIGHTBLUE}go ports${GRAY} : List of used ports \n"
printf "${LIGHTBLUE}go ip:local${GRAY} : Get local IP address \n"
printf "${LIGHTBLUE}go ip:public${GRAY} : Get public IP address \n"
printf "${LIGHTBLUE}go ip:mac${GRAY} : Get MAC Address \n"
printf "\n${WHITEBOLD}SSH Utilities: (go list:ssh) \n"
printf "${LIGHTBLUE}go ssh:download-file ${LIGHTGREEN}X${GRAY} : Download file from remote server through SSH - X = Path of the remote file to download \n"
printf "${LIGHTBLUE}go ssh:download-folder ${LIGHTGREEN}X${GRAY} : Download entire folder from remote server through SSH - X = Path of the remote folder to download \n"
printf "${LIGHTBLUE}go ssh:download-database ${LIGHTGREEN}X${GRAY} : Download database from remote server through SSH - X = Name of the database to download \n"
printf "${LIGHTBLUE}go ssh:sync:local ${LIGHTGREEN}X${GRAY} : Sync local folder with remote folder using rsync through SSH (download remote folder to local folder)\n"
printf "${LIGHTBLUE}go ssh:sync:remote ${LIGHTGREEN}X${GRAY} : Path of the remote folder to sync from local folder (upload local folder to remote folder) \n"
printf "${LIGHTBLUE}go ssh:upload ${LIGHTGREEN}X${GRAY} : Upload file to remote server through SSH - X = Path of the file to upload to the remote server \n"
printf "${LIGHTBLUE}go ssh:public-key ${LIGHTGREEN}X${GRAY} : Get public SSH key for local gohine \n"
printf "${LIGHTBLUE}go ssh:list ${LIGHTGREEN}X${GRAY} : List all the saved SSH credentials \n"
printf "\n${WHITEBOLD}Web Development Utilities: (go list:dev) \n"
printf "${LIGHTBLUE}go dev:monitor ${LIGHTGREEN}X${GRAY} : Monitor file changes (for example: log file) - X = File to monitor \n"
printf "${LIGHTBLUE}go dev:compass:compile ${LIGHTGREEN}X${GRAY} : Compile current folder using compass \n"
printf "${LIGHTBLUE}go dev:optimize-images${GRAY} : Optimize all images in current directory and subdirectories \n"
printf "${LIGHTBLUE}go dev:css:convert-to-scss${GRAY} : Convert CSS file to SCSS \n"
printf "\n${WHITEBOLD}Performance and maintenance Utilities: (go list:performance) \n"
printf "${LIGHTBLUE}go system${GRAY} : Show system information to review go performance \n"
printf "${LIGHTBLUE}go memory${GRAY} : See memory usage sorted by memory consumption \n"
printf "${LIGHTBLUE}go trash:empty${GRAY} : Empty trash\n"
printf "${LIGHTBLUE}go trash:size${GRAY} : Calculate trash size\n"
printf "\n${WHITEBOLD}iTerm / Terminal Utilities: (go list:terminal) \n"
printf "${LIGHTBLUE}go iterm:tab-title${GRAY} : Set title to current iTerm tab \n"
printf "\n${WHITEBOLD}GIT Utilities: (go list:git) \n"
printf "${LIGHTBLUE}go getmygit${GRAY} : Install my git repos (if not installed) \n"
printf "${LIGHTBLUE}go git:config${GRAY} : Display local Git configuration \n"
printf "${LIGHTBLUE}go git:open${GRAY} : Open current repository on Github \n"
printf "${LIGHTBLUE}go git:create:branch${GRAY} : Create branch based on current branch \n"
printf "${LIGHTBLUE}go git:branches:date${GRAY} : Get last update date for all branches in current project \n"
printf "${LIGHTBLUE}go git:undo-commit${GRAY} : Undo latest commit \n"
printf "${LIGHTBLUE}go git:log${GRAY} : See latest commits IDs and titles for current branch \n"
printf "${LIGHTBLUE}go git:branch${GRAY} : See all branches \n"
printf "${LIGHTBLUE}go git:branch:rename${GRAY} : Rename GIT branch \n"
printf "${LIGHTBLUE}go git:branch:remove-local${GRAY} : Remove local GIT branch \n"
printf "${LIGHTBLUE}go git:branch:remove-remote${GRAY} : Remove local and remote GIT branch \n"
printf "${LIGHTBLUE}go git:remove${GRAY} : Remove GIT from current project \n"
printf "${LIGHTBLUE}go git:settings${GRAY} : Check GIT settings \n"
printf "${LIGHTBLUE}go git:add-removed${GRAY} : Add removed files to staged files \n"
printf "${LIGHTBLUE}go git:size${GRAY} : Get size for current GIT repository \n"
printf "\n${WHITEBOLD}Web Utilities: (go list:web) \n"
printf "${LIGHTBLUE}go web:download-images${GRAY} : Download all images from website to current directory \n"
printf "\n${WHITEBOLD}Apple File System Snapshots: (go list:apfs) \n"
printf "${LIGHTBLUE}go apfs:list${GRAY} : List Available Local Snapshots \n"
printf "${LIGHTBLUE}go apfs:create${GRAY} : Create Local Snapshots \n"
#--------------------------------------------------------------------
# go script commands list - Setup & Config commands
#--------------------------------------------------------------------
elif [ "$function" == "list:setup" ]; then
printf "\n${WHITEBOLD}Setup & Config: \n"
printf "${LIGHTBLUE}go update${GRAY} : Install OS X software updates\n"
printf "${LIGHTBLUE}go defaults${GRAY} : Apply default system settings\n"
printf "${LIGHTBLUE}go install:ctags${GRAY} : Install ctags 5.8\n"
printf "${LIGHTBLUE}go install:brewpip${GRAY} : Install ALL Homebrew & PIP software\n"
printf "${LIGHTBLUE}go remove:brewpip${GRAY} : Remove ALL Homebrew & PIP software\n"
printf "${LIGHTBLUE}go update:brewpip${GRAY} : Update ALL Homebrew & PIP software\n"
printf "${LIGHTBLUE}go update:pihole${GRAY} : Update Pi-Hole software\n"
printf "${LIGHTBLUE}go install:software${GRAY} : Install necessary software\n"
printf "${LIGHTBLUE}go disable:callhome${GRAY} : Disable Apple Call Homes (custom)\n"
printf "${LIGHTBLUE}go enable:callhome${GRAY} : Enable Apple Call Homes (stock)\n"
printf "${LIGHTBLUE}go refresh:hosts${GRAY} : Refresh /etc/hosts file \n"
#--------------------------------------------------------------------
# go script commands list - general commands
#--------------------------------------------------------------------
elif [ "$function" == "list:general" ]; then
printf "\n\n${WHITEBOLD}General Utilities: \n"
printf "${LIGHTBLUE}go lock${GRAY} : Lock\n"
printf "${LIGHTBLUE}go restart${GRAY} : Restart OS X\n"
printf "${LIGHTBLUE}go sleep${GRAY} : Sleep mode\n"
printf "${LIGHTBLUE}go shutdown${GRAY} : Shutdown\n"
printf "${LIGHTBLUE}go time${GRAY} : Show clock at top right position in Terminal/iTerm\n"
printf "${LIGHTBLUE}go screensaver${GRAY} : Start screensaver\n"
printf "${LIGHTBLUE}go folders:list${GRAY} : List folders in current directory with their current size\n"
printf "${LIGHTBLUE}go folder:size${GRAY} : Calculate current folder size\n"
printf "${LIGHTBLUE}go folders:remove-empty${GRAY} : Remove empty subdirectories\n"
printf "${LIGHTBLUE}go apps:close-all${GRAY} : Close all opened apps\n"
printf "${LIGHTBLUE}go apps:app-store${GRAY} : Get list of installed apps from App Store\n"
printf "${LIGHTBLUE}go display:users${GRAY} : Display defined local accounts\n"
printf "${LIGHTBLUE}go display-all${GRAY} : Display mounted volumes and disks\n"
printf "${LIGHTBLUE}go eject-all${GRAY} : Eject all mounted volumes and disks\n"
printf "${LIGHTBLUE}go battery:status${GRAY} : Get battery information\n"
printf "${LIGHTBLUE}go info${GRAY} : Get OS X version information\n"
printf "${LIGHTBLUE}go find:text ${LIGHTGREEN}X${GRAY} : Find exact phrase recursively inside directory - ${LIGHTGREEN}X = Text string\n"
printf "${LIGHTBLUE}go find:biggest-files ${LIGHTGREEN}X${GRAY} : Find biggest files inside directory\n"
printf "${LIGHTBLUE}go find:duplicated ${GRAY} : Find duplicated files\n"
printf "${LIGHTBLUE}go find:biggest-directories ${LIGHTGREEN}X${GRAY} : Find biggest directories inside directory\n"
printf "${LIGHTBLUE}go zip:extract ${LIGHTGREEN}X${GRAY} : Extract Zip file to current folder - ${LIGHTGREEN}X = Zip file to extract\n"
printf "${LIGHTBLUE}go gzip:compress ${LIGHTGREEN}X${GRAY} : Compress current file using Gzip - ${LIGHTGREEN}X = File to compress\n"
printf "${LIGHTBLUE}go gzip:extract ${LIGHTGREEN}X${GRAY} : Extract Gzip file to current folder - ${LIGHTGREEN}X = Gzip file to extract\n"
printf "${LIGHTBLUE}go tar:compress ${LIGHTGREEN}X${GRAY} : Compress X file/directory using tar with progress indicator - ${LIGHTGREEN}X = File or directory\n"
printf "${LIGHTBLUE}go tar:extract ${LIGHTGREEN}X${GRAY} : Extract tar file to current folder - ${LIGHTGREEN}X = Tar file to extract\n"
printf "${LIGHTBLUE}go getwifipw${GRAY} : Determine SSID & Password\n"
printf "${LIGHTBLUE}go spacedock${GRAY} : Create Space In Dock\n"
printf "${LIGHTBLUE}go smallspacedock${GRAY} : Create Small Space In Dock\n"
printf "${LIGHTBLUE}go turnindexingoff${GRAY} : Turn Indexing Off\n"
printf "${LIGHTBLUE}go turnindexingon${GRAY} : Turn Indexing On\n"
printf "${LIGHTBLUE}go airplane-mode:status${GRAY} : Check Airplane Status\n"
printf "${LIGHTBLUE}go airplane-mode:on${GRAY} : Enable Airplane Mode\n"
printf "${LIGHTBLUE}go airplane-mode:off${GRAY} : Disable Airplane Mode\n"
printf "${LIGHTBLUE}go tmenable${GRAY} : Enable Local Time Machine Backups\n"
printf "${LIGHTBLUE}go tmdisable${GRAY} : Disable Local Time Machine Backups\n"
printf "${LIGHTBLUE}go tmdisablebattery${GRAY} : Disable Local Time Machine Backups While on Battery\n"
printf "${LIGHTBLUE}go tmlatest${GRAY} : Display Latest Time Machine Backup\n"
printf "${LIGHTBLUE}go tmlist${GRAY} : Display Full List of Time Machine Backups\n"
#--------------------------------------------------------------------
# go script commands list - time machine
#--------------------------------------------------------------------
elif [ "$function" == "list:tm" ]; then
printf "\n${WHITEBOLD}Time Machine: (go list:tm) \n"
printf "${LIGHTBLUE}go tmenable${GRAY} : Enable Local Time Machine Backups\n"
printf "${LIGHTBLUE}go tmdisable${GRAY} : Disable Local Time Machine Backups\n"
printf "${LIGHTBLUE}go tmdisablebattery${GRAY} : Disable Local Time Machine Backups While on Battery\n"
printf "${LIGHTBLUE}go tmlatest${GRAY} : Display Latest Time Machine Backup\n"
printf "${LIGHTBLUE}go tmlist${GRAY} : Display Full List of Time Machine Backups\n"
echo
[ -d /Volumes/MobileBackups ] && printf "***FYI*** Local Time Machine Snapshots Exist (/Volumes/MobileBackups)\n"
#--------------------------------------------------------------------
# go script commands list - search commands
#--------------------------------------------------------------------
elif [ "$function" == "list:search" ]; then
printf "\n${WHITEBOLD}Search Utilities: \n"
printf "${LIGHTBLUE}go find:recent ${LIGHTGREEN}X${GRAY} : Find files modified in the last N minutes - ${LIGHTGREEN}X = number of minutes \n"
printf "${LIGHTBLUE}go find:duplicated ${GRAY} : Find duplicated files\n"
printf "${LIGHTBLUE}go search:replace ${LIGHTGREEN}X${GRAY} : Search and replace string in file - ${LIGHTGREEN}X = File to perform the search and replace operation\n"
#--------------------------------------------------------------------
# go script commands list - network commands
#--------------------------------------------------------------------
elif [ "$function" == "list:network" ]; then
printf "\n${WHITEBOLD}Network Utilities: \n"
printf "${LIGHTBLUE}go speedtest${GRAY} : Internet connection speed test \n"
printf "${LIGHTBLUE}go ports${GRAY} : List of used ports \n"
printf "${LIGHTBLUE}go ip:local${GRAY} : Get local IP address \n"
printf "${LIGHTBLUE}go ip:public${GRAY} : Get public IP address \n"
printf "${LIGHTBLUE}go ip:mac${GRAY} : Get MAC Address \n"
#--------------------------------------------------------------------
# go script commands list - SSH commands
#--------------------------------------------------------------------
elif [ "$function" == "list:ssh" ]; then
printf "\n${WHITEBOLD}SSH Utilities: \n"
printf "${LIGHTBLUE}go ssh:download-file ${LIGHTGREEN}X${GRAY} : Download file from remote server through SSH - X = Path of the remote file to download \n"
printf "${LIGHTBLUE}go ssh:download-folder ${LIGHTGREEN}X${GRAY} : Download entire folder from remote server through SSH - X = Path of the remote folder to download \n"
printf "${LIGHTBLUE}go ssh:download-database ${LIGHTGREEN}X${GRAY} : Download database from remote server through SSH - X = Name of the database to download \n"
printf "${LIGHTBLUE}go ssh:sync:local ${LIGHTGREEN}X${GRAY} : Sync local folder with remote folder using rsync through SSH (download remote folder to local folder)\n"
printf "${LIGHTBLUE}go ssh:sync:remote ${LIGHTGREEN}X${GRAY} : Path of the remote folder to sync from local folder (upload local folder to remote folder) \n"
printf "${LIGHTBLUE}go ssh:upload ${LIGHTGREEN}X${GRAY} : Upload file to remote server through SSH - X = Path of the file to upload to the remote server \n"
printf "${LIGHTBLUE}go ssh:public-key${GRAY} : Copy SSH Public Key \n"
printf "${LIGHTBLUE}go ssh:list ${LIGHTGREEN}X${GRAY} : List all the saved SSH credentials \n"
#--------------------------------------------------------------------
# go script commands list - web development commands
#--------------------------------------------------------------------
elif [ "$function" == "list:dev" ]; then
printf "\n${WHITEBOLD}Web Development Utilities: \n"
printf "${LIGHTBLUE}go monitor ${LIGHTGREEN}X${GRAY} : Monitor file changes (for example: log file) - X = File to monitor \n"
printf "${LIGHTBLUE}go compass:compile ${LIGHTGREEN}X${GRAY} : Compile current folder using compass"
printf "${LIGHTBLUE}go dev:optimize-images${GRAY} : Optimize all images in current directory and subdirectories \n"
printf "${LIGHTBLUE}go dev:css:convert-to-scss${GRAY} : Convert CSS file to SCSS \n"
#--------------------------------------------------------------------
# go script commands list - performance commands
#--------------------------------------------------------------------
elif [ "$function" == "list:performance" ]; then
printf "\n${WHITEBOLD}Performance and maintenance Utilities: \n"
printf "${LIGHTBLUE}go system${GRAY} : Show system information to review go performance \n"
printf "${LIGHTBLUE}go memory${GRAY} : See memory usage sorted by memory consumption \n"
printf "${LIGHTBLUE}go trash:empty${GRAY} : Empty trash\n"
printf "${LIGHTBLUE}go trash:size${GRAY} : Calculate trash size\n"
#--------------------------------------------------------------------
# go script commands list - terminal commands
#--------------------------------------------------------------------
elif [ "$function" == "list:terminal" ]; then
printf "\n${WHITEBOLD}iTerm / Terminal Utilities: \n"
printf "${LIGHTBLUE}go iterm:tab-title${GRAY} : Set title to current iTerm tab \n"
#--------------------------------------------------------------------
# go script commands list - GIT commands
#--------------------------------------------------------------------
elif [ "$function" == "list:git" ]; then
printf "\n${WHITEBOLD}GIT Utilities: \n"
printf "${LIGHTBLUE}go getmygit${GRAY} : Install my git repos (if not installed) \n"
printf "${LIGHTBLUE}go git:config${GRAY} : Display local Git configuration \n"
printf "${LIGHTBLUE}go git:open${GRAY} : Open current repository on Github \n"
printf "${LIGHTBLUE}go git:create:branch${GRAY} : Create branch based on current branch \n"
printf "${LIGHTBLUE}go git:branches${GtRAY}: Get last update date for all branches in current project \n"
printf "${LIGHTBLUE}go git:undo-commit${GRAY} : Undo latest commit \n"
printf "${LIGHTBLUE}go git:log${GRAY} : See latest commits IDs and titles for current branch \n"
printf "${LIGHTBLUE}go git:branch${GRAY} : See all branches \n"
printf "${LIGHTBLUE}go git:branch:rename${GRAY} : Rename GIT branch \n"
printf "${LIGHTBLUE}go git:branch:remove-local${GRAY} : Remove local GIT branch \n"
printf "${LIGHTBLUE}go git:branch:remove-remote${GRAY} : Remove local and remote GIT branch \n"
printf "${LIGHTBLUE}go git:remove${GRAY} : Remove GIT from current project \n"
printf "${LIGHTBLUE}go git:settings${GRAY} : Check GIT settings \n"
printf "${LIGHTBLUE}go git:add-removed${GRAY} : Add removed files to staged files \n"
printf "${LIGHTBLUE}go git:size${GRAY} : Get size for current GIT repository \n"
#--------------------------------------------------------------------
# go script commands list - web commands
#--------------------------------------------------------------------
elif [ "$function" == "list:web" ]; then
printf "\n${WHITEBOLD}Web Utilities: \n"
printf "${LIGHTBLUE}go web:download-images${GRAY} : Download all images from website to current directory \n"
#--------------------------------------------------------------------
# go script commands list - apfs commands
#--------------------------------------------------------------------
elif [ "$function" == "list:apfs" ]; then
printf "\n${WHITEBOLD}APFS: \n"
printf "${LIGHTBLUE}go apfs:list${GRAY} : List Available Local Snapshots \n"
printf "${LIGHTBLUE}go apfs:create${GRAY} : Create Local Snapshots \n"
#--------------------------------------------------------------------
# General Utilities
#--------------------------------------------------------------------
elif [ "$function" == "defaults" ]; then
# Applies system and application defaults
# Ask for the administrator password upfront.
sudo -v
# Keep-alive: update existing `sudo` time stamp until the script has finished.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# EXECUTION
printf "System - Disable boot sound effects\n"
#sudo nvram SystemAudioVolume=" "
printf "System - Enable boot sound effects\n"
# Disabled on 2016 & Later MBP models
sudo nvram BootAudio=%01
printf "System - Enable Macbook Power Chime with Plugged in\n"
defaults write com.apple.PowerChime ChimeOnAllHardware -bool true; open /System/Library/CoreServices/PowerChime.app &
printf "System - Reveal IP address, hostname, OS version, etc. when clicking the login window clock\n"
sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
# Checking if ~/Pictures/Screenshots exists
if [[ ! -d "~/Pictures/Screenshots" ]]; then
echo "~/Pictures/Screenshots does not exist, creating..."
mkdir ~/Pictures/Screenshots
fi
printf "System - Move Screeshot location to ~/Pictures/Screenshots\n"
defaults write com.apple.screencapture location ~/Pictures/Screenshots
printf "System - Disable automatic termination of inactive apps\n"
defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true
printf "System - Expand save panel by default\n"
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
printf "System - Disable the 'Are you sure you want to open this application?' dialog\n"
defaults write com.apple.LaunchServices LSQuarantine -bool false
printf "System - Speed Up Animations\n"
defaults write -g NSWindowResizeTime -float 0.003
printf "System - Disable animations when opening and closing windows\n"
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
printf "System - Disable animations when opening a Quick Look window\n"
defaults write -g QLPanelAnimationDuration -float 0
printf "System - Make all animations faster that are used by Mission Control\n"
defaults write com.apple.dock expose-animation-duration -float 0.1
printf "System - Increase window resize speed for Cocoa applications\n"
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
printf "System - Disable window resume system-wide\n"
defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false
printf "System - Disable auto-correct\n"
#defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
printf "System - Disable smart quotes (not useful when writing code)\n"
#defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
printf "System - Disable smart dashes (not useful when writing code)\n"
#defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
printf "System - Require password immediately after sleep or screen saver begins\n"
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
printf "System - Avoid creating .DS_Store files on network volumes\n"
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
printf "System - Avoid creating .DS_Store files on USB volumes\n"
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
printf "System - Automatically restart if system freezes\n"
systemsetup -setrestartfreeze on
printf "System - Disable software updates\n"
#sudo softwareupdate --schedule off
printf "System - Disable Sudden Motion Sensor (not needed for SSD drives)\n"
sudo pmset -a sms 0
printf "System - Enable the firewall\n"
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on
printf "System - Enable logging\n"
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setloggingmode on
printf "System - Enable stealth mode\n"
# Computer hackers scan networks so they can attempt to identify computers to attack. You can prevent your computer from responding to some of these scans by using stealth mode. When stealth mode is enabled, your computer does not respond to ICMP ping requests, and does not answer to connection attempts from a closed TCP or UDP port. This makes it more difficult for attackers to find your computer.
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setstealthmode on
printf "System - Disable Captive Portal assistant utility\n"
# An attacker could trigger the utility and direct a Mac to a site with malware without user interaction, so it's best to disable this feature and log in to captive portals using your regular Web browser, provided you have first disable any custom dns and/or proxy settings.
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.captive.control Active -bool false
printf "Rename default boot disk name\n"
if [[ -d "/Volumes/Macintosh HD" ]]; then
printf "Renaming boot disks:"
/usr/sbin/diskutil rename "Macintosh HD" "macOS"
fi
printf "System - Download raw list hosts to block known malware, advertising or otherwise unwanted domains.\n"
sleep 3
#
sudo cp -p /etc/hosts /etc/hosts.${datestamp}
echo "Copying down raw list hosts file (Must have connection to internet)...\n"
curl "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" | sudo tee /etc/hosts
sleep 3
printf "Keyboard - Automatically illuminate built-in MacBook keyboard in low light\n"
defaults write com.apple.BezelServices kDim -bool true
printf "Keyboard - Turn off keyboard illumination when computer is not used for 5 minutes\n"
defaults write com.apple.BezelServices kDimTime -int 300
printf "Keyboard - Enable keyboard access for all controls\n"
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
printf "Keyboard - Set a fast keyboard repeat rate\n"
defaults write NSGlobalDomain KeyRepeat -int 0
printf "Keyboard - Disable press-and-hold for keys in favor of key repeat\n"
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
printf "Mouse - Smooth Scrolling - Useful if you’re on an older Mac that messes up the animation.\n"
# Disable
#defaults write -g NSScrollAnimationEnabled -bool false
# Enable (Default)
defaults write -g NSScrollAnimationEnabled -bool true
printf "Scrollbar Visibility - Possible values: WhenScrolling, Automatic and Always.\n"
defaults write -g AppleShowScrollBars -string "Always"
printf "Trackpad - Map bottom right corner to right-click\n"
#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
printf "Trackpad - Enable tap to click for current user and the login screen\n"
#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
printf "Trackpad - Use CONTROL (^) with scroll to zoom\n"
#defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
#defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
printf "Trackpad - Follow keyboard focus while zoomed in\n"
defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true
printf "Bluetooth - Increase sound quality for headphones/headsets\n"
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
printf "Menu Bar - Show only Bluetooth and Airport\n"
#for domain in $HOME/Library/Preferences/ByHost/com.apple.systemuiserver.*; do
# defaults write "${domain}" dontAutoLoad -array "/System/Library/CoreServices/Menu Extras/TimeMachine.menu"
# done
# defaults write com.apple.systemuiserver menuExtras -array \
# "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" \
# "/System/Library/CoreServices/Menu Extras/AirPort.menu"
printf "Dock - Add a Stack with Recent Applications\n"
defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }' && \
killall Dock
printf "Dock - Remove all default app icons\n"
# defaults write com.apple.dock persistent-apps -array
printf "Dock - Automatically hide and show\n"
# defaults write com.apple.dock autohide -bool true
printf "Dock - Remove the auto-hiding delay\n"
# defaults write com.apple.Dock autohide-delay -float 0
printf "Dock - Don’t show Dashboard as a Space\n"
# defaults write com.apple.dock "dashboard-in-overlay" -bool true
printf "iCloud - Save to disk by default (not to iCloud)\n"
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
printf "Finder - Show the $HOME/Library folder\n"
chflags nohidden $HOME/Library
printf "Finder - Show the /Volumes folder\n"
chflags nohidden /Volumes
printf "Finder - Show hidden files\n"
defaults write com.apple.finder AppleShowAllFiles -bool true
printf "Finder - Show filename extensions\n"
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
printf "Finder - Disable the warning when changing a file extension\n"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
printf "Finder - Show path bar\n"
defaults write com.apple.finder ShowPathbar -bool true
printf "Finder - Show status bar\n"
defaults write com.apple.finder ShowStatusBar -bool true
printf "Finder - Display full POSIX path as window title\n"
# defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
printf "Finder - Use list view in all Finder windows\n"
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
printf "Finder - Allow quitting via COMMAND+Q -- Doing so will also hide desktop icons\n"
# defaults write com.apple.finder QuitMenuItem -bool true
printf "Finder - Disable the warning before emptying the Trash\n"
# defaults write com.apple.finder WarnOnEmptyTrash -bool false
printf "Finder - Allow text selection in Quick Look\n"
defaults write com.apple.finder QLEnableTextSelection -bool true
printf "Safari - Set home page to 'about:blank' for faster loading\n"
defaults write com.apple.Safari HomePage -string "about:blank"
printf "Safari - Hide bookmarks bar\n"
#defaults write com.apple.Safari ShowFavoritesBar -bool false
printf "Safari - Use Contains instead of Starts With in search banners\n"
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
printf "Safari - Enable debug menu\n"
#defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
defaults write com.apple.Safari IncludeInternalDebugMenu 1
printf "Safari - Enable the Develop menu and the Web Inspector\n"
#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
printf "Safari - Add a context menu item for showing the Web Inspector in web views\n"
#defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
printf "Safari - Disable sending search queries to Apple.\n"
defaults write com.apple.Safari UniversalSearchEnabled -bool false
printf "Chrome - Prevent native print dialog, use system dialog instead\n"
defaults write com.google.Chrome DisablePrintPreview -boolean true
printf "Photos - Disable Photos show up when devices are plugged (OS X 10.11 and earlier)"
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
printf "Mail - Copy email addresses as 'foo@example.com' instead of 'Foo Bar <foo@example.com>'\n"
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
printf "Mail - Disable send animation\n"
defaults write com.apple.mail DisableSendAnimations -bool true
printf "Mail - Disable reply animation\n"
defaults write com.apple.mail DisableReplyAnimations -bool true
printf "Mail - Enable COMMAND+ENTER to send mail\n"
defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" -string "@\\U21a9"
printf "Address Book - Enable debug menu\n"
#defaults write com.apple.addressbook ABShowDebugMenu -bool true
printf "iCal - Enable debug menu\n"
#defaults write com.apple.iCal IncludeDebugMenu -bool true
printf "TextEdit - Use plain text mode for new documents\n"
defaults write com.apple.TextEdit RichText -int 0
printf "TextEdit - Open and save files as UTF-8 encoding\n"
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
printf "Disk Utility - Enable debug menu\n"
defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true
defaults write com.apple.DiskUtility advanced-image-options -bool true
printf "Time Machine - Prevent prompting to use new hard drives as backup volume\n"
defaults write /Library/Preferences/com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
printf "Time Machine - Change Backup Interval. The integer value is the time in seconds.\n"
# Needs to be investigated:
sudo defaults write /System/Library/Launch Daemons/com.apple.backupd-auto StartInterval -int 10800
printf "Printer - Expand print panel by default\n"
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
printf "Printer - Automatically quit printer app once the print jobs complete\n"
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
printf "App Store - Enable the WebKit Developer Tools in the Mac App Store\n"
#defaults write com.apple.appstore WebKitDeveloperExtras -bool true
printf "App Store - Enable Debug Menu in the Mac App Store\n"
defaults write com.apple.appstore ShowDebugMenu -bool true
printf "Overall - SystemUIServer relaunch"
killall SystemUIServer
printf "System - Setup Hot Corners"
# Hot corners
# Possible values:
# 0: no-op
# 2: Mission Control
# 3: Show application windows
# 4: Desktop
# 5: Start screen saver
# 6: Disable screen saver
# 7: Dashboard
# 10: Put display to sleep
# 11: Launchpad
# 12: Notification Center
# Top left screen corner → Start screen saver
defaults write com.apple.dock wvous-tl-corner -int 5
defaults write com.apple.dock wvous-tl-modifier -int 0
# Top right screen corner →
#defaults write com.apple.dock wvous-tr-corner -int 0
#defaults write com.apple.dock wvous-tr-modifier -int 0
# Bottom left screen corner → Mission Control
defaults write com.apple.dock wvous-bl-corner -int 2
defaults write com.apple.dock wvous-bl-modifier -int 0
# Bottom Right screen corner → Show Desktop
defaults write com.apple.dock wvous-br-corner -int 4
defaults write com.apple.dock wvous-br-modifier -int 0
printf "Google - Uninstall Google Update\n"
~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Resources/ksinstall --nuke
elif [ "$function" == "disable:callhome" ]; then
bash applecallhome.sh fixmacos
elif [ "$function" == "enable:callhome" ]; then
bash applecallhome.sh restore
elif [ "$function" == "refresh:hosts" ]; then
echo "Making copy of current /etc/hosts to /etc/hosts.${datestamp}"
sudo cp -p /etc/hosts /etc/hosts.${datestamp}
echo "Copying down updated raw list hosts file (Must have connection to internet)...\n"
curl "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" | sudo tee /etc/hosts
sleep 1
echo "Copying in local template entries"
if [ -f ~/Scripts/hosts.local.template ]; then
cat ~/Scripts/hosts.local.template | sudo tee -a /etc/hosts
fi
echo "Refreshing local DNS"
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
echo "DNS cache cleared"
elif [ "$function" == "install:ctags" ]; then
if [ ! -d ~/Downloads/ctags-5.8 ]; then
cd ~/Downloads
curl -O http://peterszaro.com/ctags-5.8.tar.gz
tar xzvf ctags-5.8.tar.gz
cd ~/Downloads/ctags-5.8
./configure
make
sudo make install
fi
elif [ "$function" == "install:brewpip" ]; then
# Installs Homebrew and PIP software
#
# Homebrew
#
# If older ctags version exists, delete file
[ -f /usr/local/bin/ctags ] && rm '/usr/local/bin/ctags'
if ! command -v brew > /dev/null; then
ruby -e "$(curl --location --fail --silent --show-error https://raw.githubusercontent.com/Homebrew/install/master/install)"
export PATH="/usr/local/bin:$PATH"
printf "export PATH=\"/usr/local/bin:$PATH\"\n" >> $HOME/.bash_profile
fi
# According to Homebrew's Anonymous Aggregate User Behaviour Analytics, Homebrew gathers anonymous aggregate user behaviour analytics and reporting these to Google Analytics. To opt out of Homebrew's analytics:
brew analytics off
# topgrade
# https://github.com/r-darwish/topgrade
brew install topgrade
# mas
brew install mas
# ctags
brew install ctags
# Readline
brew install readline
# OpenSSL
brew install openssl
brew link openssl --force
# Python
brew install python
# Bash
brew install bash
# Bash Completion
brew install bash-completion
# ShellCheck
brew install shellcheck
# Tree
brew install tree
# Git
brew install git
# GitHub
brew install hub
# GitHub Issues
brew install ghi
# Terminal Notifier
brew install terminal-notifier
# Watchman
brew install watchman
# Silver Searcher
brew install the_silver_searcher
# jq (https://stedolan.github.io/jq/)
brew install jq
# libdvdcss (since it was removed in El Capitan - https://www.reddit.com/r/osx/comments/3n6gz4/el_capitan_apparently_broke_handbrake_ripping/)
brew install libdvdcss
# ccat
brew install ccat
# gcc
brew install gcc
# speedtest-cli
brew install speedtest-cli
# mackup
brew install mackup
# StormSSH
brew install stormssh
# wget
brew install wget
# dockutil
brew install dockutil
# known_hosts
brew install known_hosts
# dsh
brew install dsh
# noti
brew install noti
# Caffiene
brew cask install caffeine
# Brew Cask
brew tap caskroom/cask
export HOMEBREW_CASK_OPTS="--appdir=/Applications"
#
# PIP
#
# AWS CLI https://aws.amazon.com/cli/
${PIPLOC}/pip3 install awscli
# glances (https://nicolargo.github.io/glances/)
${PIPLOC}/pip3 install glances
# Ansible
${PIPLOC}/pip3 install ansible
elif [ "$function" == "remove:brewpip" ]; then
echo "Discovering brew packages installed and will remove..."
for p in `brew list`; do brew remove $p; done
echo "Discovering pip packages installed and will remove..."
for p in `${PIPLOC}/pip3 list`; do ${PIPLOC}/pip3 uninstall $p; done
elif [ "$function" == "update:brewpip" ]; then
echo "Updating Homebrew and its installed packages..."
printf "${GREEN}brew update; brew upgrade; brew cleanup;\n${NC}"
brew update; brew upgrade; brew cleanup;
echo
sleep 3
echo
echo "Updating installed pip packages..."
#printf "${GREEN}pip3 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U\n${NC}"
printf "${GREEN}pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U\n${NC}"
#${PIPLOC}/pip3 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 ${PIPLOC}/pip3 install -U
pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
echo
elif [ "$function" == "update:pihole" ]; then
echo "Updating Pi-Hole on remote server..."
echo "Connecting to Pi-Master..."
sleep 3
printf "${GREEN}ssh 192.168.0.11 "pihole -up";\n${NC}"
ssh 192.168.0.11 "pihole -up"
echo
sleep 3
echo
elif [ "$function" == "install:software" ]; then
xcode_install
echo "Installing Applications via cask..."
export HOMEBREW_CASK_OPTS="--appdir=/Applications"
brew cask install dropbox
brew cask install gitup
brew cask install textexpander
brew cask install google-chrome
brew cask install transmit
brew cask install divvy
brew cask install iterm2
brew cask install growlnotify
brew cask install cleanmymac
brew cask install geektool
brew cask install atom
brew cask install timemachineeditor
brew cask install nvalt
brew cask install bartender
brew cask install etcher
# Install OS X software updates, update installed Ruby gems, Homebrew, pip and their installed packages
elif [ "$function" == "update" ]; then
echo "Updating OS X..."