forked from vraravam/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathosx-defaults.sh
More file actions
executable file
·1777 lines (1436 loc) · 85.9 KB
/
Copy pathosx-defaults.sh
File metadata and controls
executable file
·1777 lines (1436 loc) · 85.9 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
#!/usr/bin/env bash
# This is a script with useful tips taken from: https://gist.github.com/DAddYE/2108403
# Please, share your tips by forking the repo and adding your customizations
# Thanks to: @erikh, @DAddYE, @mathiasbynens
case "${1}" in
"-s" | "--silent" )
echo "Running in silent mode..."
auto=Y
shift 1
;;
* )
auto=N
if [ ! -t 0 ]; then
echo "Interactive mode needs terminal!" >&2
exit 1
fi
;;
esac
type green &> /dev/null 2>&1 || source "${HOME}/.shellrc"
ask() {
while true; do
if [ "${2}" == "Y" ]; then
prompt="$(green 'Y')/n"
default=Y
elif [ "${2}" == "N" ]; then
prompt="y/$(green 'N')"
default=N
else
prompt="y/n"
default=
fi
printf "${1} [$prompt] "
if [ "$auto" == "Y" ]; then
echo
else
read yn
fi
if [ -z "$yn" ]; then
yn=$default
fi
case $yn in
[Yy]*) return 0 ;;
[Nn]*) return 1 ;;
esac
done
}
# Close any open System Preferences panes, to prevent them from overriding
# settings we're about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# While applying any changes to SoftwareUpdate defaults, set software update to OFF to avoid any conflict with the defaults system cache. (Also close the System Preferences app)
sudo softwareupdate --schedule OFF
###############################################################################
# Couldn't find the following settings in macOS Mojave (10.14.3) #
###############################################################################
# Expand "save as..." dialog by default
# defaults write -g NSNavPanelExpandedStateForSaveMode -bool true
# defaults write -g NSNavPanelExpandedStateForSaveMode2 -bool true
# Expand print panel by default
# defaults write -g PMPrintingExpandedStateForPrint -bool true
# defaults write -g PMPrintingExpandedStateForPrint2 -bool true
# Restore the 'Save As' menu item (Equivalent to adding a Keyboard shortcut in the System Preferences.app )
# defaults write -g NSUserKeyEquivalents -dict-add 'Save As...' '@$S'
# Global User Interface Scale Multiplier:
# defaults write -g AppleDisplayScaleFactor -float
# Enable continuous spell checking everywhere:
# defaults write -g WebContinuousSpellCheckingEnabled -boolean
# Enable automatic dash replacement everywhere:
# defaults write -g WebAutomaticDashSubstitutionEnabled -boolean
# Enable automatic text replacement everywhere:
# defaults write -g WebAutomaticTextReplacementEnabled -boolean
# Icon Size for Open Panels:
# defaults write -g NSNavPanelIconViewIconSizeForOpenMode -number
# Disable press-and-hold for keys in favor of key repeat
# Set a blazingly fast keyboard repeat rate
# defaults write NSGlobalDomain KeyRepeat -int 1
# defaults write NSGlobalDomain InitialKeyRepeat -int 10
###############################################################################
# Login Window #
###############################################################################
if ask "Disable guest login" Y; then
sudo defaults write /Library/Preferences/com.apple.loginwindow GuestEnabled -bool false
fi
###############################################################################
# MenuBar #
###############################################################################
# Disable menu bar transparency - Couldn't find this in mac OS Mojave
# defaults write -g AppleEnableMenuBarTransparency -bool false
if ask "Show remaining battery time" N; then
defaults write com.apple.menuextra.battery ShowTime -string "YES"
fi
if ask "Show remaining battery percentage" Y; then
defaults write com.apple.menuextra.battery ShowPercent -string "YES"
fi
if ask "Turn off Battery in menubar" Y; then
defaults -currentHost write com.apple.controlcenter Battery 8
fi
if ask "Show remaining battery percentage" Y; then
defaults -currentHost write com.apple.controlcenter BatteryShowPercentage -bool true
fi
if ask "Show bluetooth in menubar" Y; then
defaults -currentHost write com.apple.controlcenter Bluetooth 2
fi
if ask "Keep keyboard brightness at max value" Y; then
defaults -currentHost write com.apple.controlcenter KeyboardBrightness 8
fi
###############################################################################
# General UI/UX #
###############################################################################
if ask "Set computer name (as done via System Preferences → Sharing)" Y; then
userNameInCamelCase=$(echo "$(whoami)" | awk '{$1=toupper(substr($1,0,1))substr($1,2)}1')
sudo scutil --set ComputerName "IND-CHN-${userNameInCamelCase}'s MBP-$(date)"
sudo scutil --set HostName "${userNameInCamelCase}"
sudo scutil --set LocalHostName "${userNameInCamelCase}"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "${userNameInCamelCase}"
fi
if ask "Set standby delay to 6 hours (default: 1 hour)" Y; then
sudo pmset -a standbydelay 21600
fi
# Disable the sound effects on boot
# sudo nvram SystemAudioVolume=" "
# Disable transparency in the menu bar and elsewhere on Yosemite
# defaults write com.apple.universalaccess reduceTransparency -bool true
# Set highlight color to green
# defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600"
for domain in "${HOME}"/Library/Preferences/ByHost/com.apple.systemuiserver.*; do
defaults write "${domain}" dontAutoLoad -array \
"/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \
"/System/Library/CoreServices/Menu Extras/Volume.menu" \
"/System/Library/CoreServices/Menu Extras/User.menu"
done
defaults write com.apple.systemuiserver menuExtras -array \
"/System/Library/CoreServices/Menu Extras/Bluetooth.menu" \
"/System/Library/CoreServices/Menu Extras/AirPort.menu" \
"/System/Library/CoreServices/Menu Extras/Battery.menu" \
"/System/Library/CoreServices/Menu Extras/Clock.menu" \
"/System/Library/CoreServices/Menu Extras/User.menu" \
"/System/Library/CoreServices/Menu Extras/Volume.menu"
defaults write com.apple.systemuiserver "NSStatusItem Visible Siri" -bool false
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.airport" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.appleuser" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.battery" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.bluetooth" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.volume" -bool true
defaults write com.apple.menuextra.clock DateFormat -string "EEE d MMM h:mm:ss a"
defaults write com.apple.menuextra.clock FlashDateSeparators -bool true
defaults write com.apple.menuextra.clock IsAnalog -bool true # Since I am using `The Clocker` app, turning this to analog
defaults write com.apple.menuextra.clock IsAnalog -bool true
defaults write com.apple.menuextra.clock Show24Hour -bool false
defaults write com.apple.menuextra.clock ShowAMPM -bool true
defaults write com.apple.menuextra.clock ShowDate -bool false
defaults write com.apple.menuextra.clock ShowDayOfMonth -bool true
defaults write com.apple.menuextra.clock ShowDayOfWeek -bool false
defaults write com.apple.menuextra.clock ShowSeconds -bool true
if ask "Remove duplicates in the 'Open With' menu (also see 'lscleanup' alias)" Y; then
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
fi
# Display ASCII control characters using caret notation in standard text views
# Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt`
# defaults write -g NSTextShowsControlCharacters -bool true
# if ask "Enable multitouch trackpad auto orientation sensing (for all users)" Y; then
# defaults write /Library/Preferences/com.apple.MultitouchSupport ForceAutoOrientation -boolean
# fi
if ask "Enable Resume applications on reboot (system-wide)" Y; then
defaults write -g NSQuitAlwaysKeepsWindows -bool true
fi
if ask "Restart automatically if the computer freezes" Y; then
sudo systemsetup -setrestartfreeze on
fi
if ask "Set the timezone" Y; then
# see 'sudo systemsetup -listtimezones' for other values
sudo systemsetup -settimezone "Asia/Calcutta"
fi
if ask "Set the time using the network time" Y; then
sudo systemsetup -setusingnetworktime on
fi
if ask "Set the computer sleep time to 10 minutes" Y; then
# To never go into computer sleep mode, use 'Never' or 'Off'
sudo systemsetup -setcomputersleep 10
fi
if ask "Set the display sleep time to 10 minutes" Y; then
# To never go into display sleep mode, use 'Never' or 'Off'
sudo systemsetup -setdisplaysleep 10
fi
if ask "Set the harddisk sleep time to 15 minutes" Y; then
# To never go into harddisk sleep mode, use 'Never' or 'Off'
sudo systemsetup -setharddisksleep 15
fi
# TODO: This causes terminal.app to run in an interactive loop
# if ask "Set the remote login to off" Y; then
# sudo systemsetup -setremotelogin off
# fi
# Disable Notification Center and remove the menu bar icon
# launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null
if ask "Disable automatic capitalization as it's annoying when typing code" Y; then
defaults write -g NSAutomaticCapitalizationEnabled -bool false
fi
if ask "Set the languages present" Y; then
defaults write -g NSLinguisticDataAssetsRequested -array "en_IN" "en_US" "en"
defaults delete NSGlobalDomain NSNavRecentPlaces
fi
# TODO: defaults write -g NSPreferredWebServices NSWebServicesProviderWebSearch
if ask "Set the some english acronyms/short forms for ease of typing" Y; then
defaults write -g NSUserDictionaryReplacementItems -array \
'{ on = 1; replace = dfdm; with = "dropping off for different meeting"; }' \
'{ on = 1; replace = ntd; with = "need to drop"; }' \
'{ on = 1; replace = cyl; with = "Cya later!"; }' \
'{ on = 1; replace = ttyl; with = "Talk to you later!"; }' \
'{ on = 1; replace = omw; with = "On my way!"; }' \
'{ on = 1; replace = omg; with = "Oh my God!"; }'
fi
if ask "Disable automatic period substitution as it's annoying when typing code" Y; then
defaults write -g NSAutomaticPeriodSubstitutionEnabled -bool false
fi
# TODO: This is not working yet
# Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and
# all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`.
#rm -rf ${HOME}/Library/Application Support/Dock/desktoppicture.db
#sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg
#sudo ln -s /path/to/your/image /System/Library/CoreServices/DefaultDesktop.jpg
###############################################################################
# TextEdit #
###############################################################################
###############################################################################
# SSD-specific tweaks #
###############################################################################
if ask "Disable hibernation (speeds up entering sleep mode)" Y; then
sudo pmset -a hibernatemode 0
fi
if ask "Disable the sudden motion sensor as it's not useful for SSDs" Y; then
sudo pmset -a sms 0
fi
###############################################################################
# Trackpad, mouse, keyboard, Bluetooth accessories, and input #
###############################################################################
if ask "Enable Trackpad Gestures" Y; then
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -int 1
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad DragLock -int 0
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Dragging -int 0
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 0
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadFiveFingerPinchGesture -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadFourFingerHorizSwipeGesture -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadFourFingerPinchGesture -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadFourFingerVertSwipeGesture -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadHandResting -int 1
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadHorizScroll -int 1
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadMomentumScroll -int 1
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadPinch -int 1
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -int 1
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRotate -int 1
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadScroll -int 1
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerDrag -int 0
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerHorizSwipeGesture -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerTapGesture -int 0
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerVertSwipeGesture -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadTwoFingerDoubleTapGesture -int 1
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadTwoFingerFromRightEdgeSwipeGesture -int 3
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad USBMouseStopsTrackpad -int 0
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad UserPreferences -int 1
fi
if ask "Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)" Y; then
defaults write -g AppleKeyboardUIMode -int 2
fi
if ask "Set language and text formats" Y; then
# Note: if you're in the US, replace `EUR` with `USD`, `Centimeters` with
# `Inches`, `en_GB` with `en_US`, and `true` with `false`.
defaults write -g AppleLanguages -array "en-IN" "en"
defaults write -g AppleLocale -string "en_IN@currency=INR"
defaults write -g AppleMeasurementUnits -string "Centimeters"
defaults write -g AppleMetricUnits -bool true
defaults write -g AppleActionOnDoubleClick -string "Maximize"
fi
# Stop iTunes from responding to the keyboard media keys
# launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null
# Use scroll gesture with the Ctrl (^) modifier key to zoom
# defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
# defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
# Follow the keyboard focus while zoomed in
# defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true
###############################################################################
# Finder #
###############################################################################
if ask "Allow quitting Finder via ⌘ + Q; doing so will also hide desktop icons" Y; then
defaults write com.apple.finder QuitMenuItem -bool true
fi
# if ask "Disable window animations and Get Info animations" Y; then
# defaults write com.apple.finder DisableAllAnimations -bool true
# fi
if ask "Set Desktop as the default location for new Finder windows" Y; then
# For other paths, use `PfLo` and `file:///full/path/here/`
defaults write com.apple.finder NewWindowTarget -string "PfHm"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
fi
if ask "Show icons for hard drives, servers, and removable media on the desktop" Y; then
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false
fi
# if ask "Show hidden files by default" N; then
# defaults write com.apple.finder AppleShowAllFiles -bool false
# fi
if ask "Show all filename extensions" Y; then
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
fi
if ask "Display full POSIX path as Finder window title" Y; then
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
fi
if ask "Show status bar" Y; then
defaults write com.apple.finder ShowStatusBar -bool true
fi
if ask "Start the status bar Path at ${HOME} (instead of Hard drive)" N; then
defaults write /Library/Preferences/com.apple.finder PathBarRootAtHome -bool true
fi
if ask "Show path (breadcrumb) bar" Y; then
defaults write com.apple.finder ShowPathbar -bool true
fi
if ask "Show preview pane" Y; then
defaults write com.apple.finder ShowPreviewPane -bool false
fi
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowRecentTags -bool false
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
defaults write com.apple.finder ShowSidebar -bool true
defaults write com.apple.finder SidebarDevicesSectionDisclosedState -bool true
defaults write com.apple.finder SidebarPlacesSectionDisclosedState -bool true
defaults write com.apple.finder SidebarShowingSignedIntoiCloud -bool true
defaults write com.apple.finder SidebarShowingiCloudDesktop -bool true
defaults write com.apple.finder SidebarTagsSctionDisclosedState -bool true
defaults write com.apple.finder SidebarWidth 172
defaults write com.apple.finder SidebariCloudDriveSectionDisclosedState -bool true
if ask "Allowing text selection in Quick Look/Preview in Finder by default" Y; then
defaults write com.apple.finder QLEnableTextSelection -bool true
fi
# if ask "Keep folders on top when sorting by name" Y; then
# defaults write com.apple.finder _FXSortFoldersFirst -bool true
# fi
if ask "When performing a search, search the current folder by default (the default 'This Mac' is 'SCev')" Y; then
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
fi
if ask "Disable the warning when changing a file extension" Y; then
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
fi
# if ask "Enable spring loading for directories" Y; then
# defaults write -g com.apple.springing.enabled -bool true
# fi
# if ask "Remove the delay for spring loading for directories" Y; then
# defaults write -g com.apple.springing.delay -float 0
# fi
if ask "Enable snap-to-grid for icons on the desktop and in other icon views" Y; then
/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
fi
if ask "Increase grid spacing for icons on the desktop and in other icon views" Y; then
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 54" ${HOME}/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 54" ${HOME}/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 54" ${HOME}/Library/Preferences/com.apple.finder.plist
fi
if ask "Increase the size of icons on the desktop and in other icon views" Y; then
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 64" ${HOME}/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 64" ${HOME}/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 64" ${HOME}/Library/Preferences/com.apple.finder.plist
fi
# Show item info near icons on the desktop and in other icon views
# /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ${HOME}/Library/Preferences/com.apple.finder.plist
# /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ${HOME}/Library/Preferences/com.apple.finder.plist
# /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ${HOME}/Library/Preferences/com.apple.finder.plist
# Show item info to the right of the icons on the desktop
# /usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ${HOME}/Library/Preferences/com.apple.finder.plist
# 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
# Increase grid spacing for icons on the desktop and in other icon views
# /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ${HOME}/Library/Preferences/com.apple.finder.plist
# /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ${HOME}/Library/Preferences/com.apple.finder.plist
# /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ${HOME}/Library/Preferences/com.apple.finder.plist
# Increase the size of icons on the desktop and in other icon views
# /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ${HOME}/Library/Preferences/com.apple.finder.plist
# /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ${HOME}/Library/Preferences/com.apple.finder.plist
# /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ${HOME}/Library/Preferences/com.apple.finder.plist
if ask "Use list view in all Finder windows by default" Y; then
# Four-letter codes for the other view modes: `icnv` (icon), `Nlsv` (list), `Flwv` (cover flow)
defaults write com.apple.finder FXPreferredViewStyle -string "clmv"
defaults write com.apple.finder SearchRecentsSavedViewStyle -string "clmv"
fi
if ask "Disable the warning before emptying the Trash" Y; then
defaults write com.apple.finder WarnOnEmptyTrash -bool false
fi
if ask "Empty Trash securely by default" Y; then
defaults write com.apple.finder EmptyTrashSecurely -bool true
fi
if ask "Show app-centric sidebar" Y; then
defaults write com.apple.finder FK_AppCentricShowSidebar -bool true
fi
if ask "Automatically open a new Finder window when a volume is mounted" Y; then
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
fi
if ask "Show the ${HOME}/Library folder" Y; then
chflags nohidden ${HOME}/Library
fi
if ask "Enable the MacBook Air SuperDrive on any Mac" N; then
sudo nvram boot-args="mbasd=1"
fi
if ask "Show the '/Volumes' folder" Y; then
chflags nohidden /Volumes
fi
# Remove Dropbox's green checkmark icons in Finder
# file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns
# [ -e "${file}" ] && mv -f "${file}" "${file}.bak"
if ask "Expand the following File Info panes: 'General', 'Open with', and 'Sharing & Permissions'" Y; then
defaults write com.apple.finder FXInfoPanesExpanded -dict-add "General" -bool true
defaults write com.apple.finder FXInfoPanesExpanded -dict-add "MetaData" -bool false
defaults write com.apple.finder FXInfoPanesExpanded -dict-add "OpenWith" -bool true
defaults write com.apple.finder FXInfoPanesExpanded -dict-add "Privileges" -bool true
fi
if ask "Windows which were open prior to logging out are re-opened after logging in" Y; then
defaults write com.apple.finder RestoreWindowState -bool true
fi
# if ask "Location and style of scrollbar arrows" N; then
# Applications often need to be relaunched to see the change.
# defaults write -g AppleScrollBarVariant -string "DoubleBoth" true
# fi
# if ask "Disable window animations" N; then
# defaults write -g NSAutomaticWindowAnimationsEnabled -bool false && killall Finder
# fi
###############################################################################
# Energy saving #
###############################################################################
# Enable lid wakeup
sudo pmset -a lidwake 1
# Restart automatically on power loss
sudo pmset -a autorestart 1
# Restart automatically if the computer freezes
sudo systemsetup -setrestartfreeze on
# Sleep the display after 15 minutes
# sudo pmset -a displaysleep 15
# Disable machine sleep while charging
# sudo pmset -c sleep 0
# Set machine sleep to 5 minutes on battery
# sudo pmset -b sleep 5
# Set standby delay to 24 hours (default is 1 hour)
# sudo pmset -a standbydelay 86400
# Never go into computer sleep mode
# sudo systemsetup -setcomputersleep Off > /dev/null
# Hibernation mode
# 0: Disable hibernation (speeds up entering sleep mode)
# 3: Copy RAM to disk so the system state can still be restored in case of a
# power failure.
# sudo pmset -a hibernatemode 0
# Remove the sleep image file to save disk space
# sudo rm /private/var/vm/sleepimage
# Create a zero-byte file instead…
# sudo touch /private/var/vm/sleepimage
# …and make sure it can't be rewritten
# sudo chflags uchg /private/var/vm/sleepimage
###############################################################################
# Preview #
###############################################################################
# if ask "Scale images by default when printing" N; then
# defaults write com.apple.Preview PVImagePrintingScaleMode -bool true
# fi
# if ask "Preview Auto-rotate by default when printing" N; then
# defaults write com.apple.Preview PVImagePrintingAutoRotate -bool true
# fi
# if ask "Quit Always Keeps Windows" Y; then
# defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool true
# fi
###############################################################################
# Keychain #
###############################################################################
if ask "Keychain shows expired certificates" N; then
defaults write com.apple.keychainaccess "Show Expired Certificates" -bool true
fi
if ask "Makes Keychain Access display *unsigned* ACL entries in italics" Y; then
defaults write com.apple.keychainaccess "Distinguish Legacy ACLs" -bool true
fi
###############################################################################
# Remote Desktop #
###############################################################################
# if ask "Admin Console Allows Remote Control" N; then
# defaults delete /Library/Preferences/com.apple.RemoteManagement AdminConsoleAllowsRemoteControl
# fi
# if ask "Disable Multicast" N; then
# defaults write /Library/Preferences/com.apple.RemoteManagement ARD_MulticastAllowed -bool true
# fi
# if ask "Prevents system keys like command-tab from being sent" N; then
# defaults write com.apple.RemoteDesktop DoNotSendSystemKeys -bool true
# fi
if ask "Show the Debug menu Remote Desktop" Y; then
defaults write com.apple.remotedesktop IncludeDebugMenu -bool true
fi
if ask "Define user name display behavior" Y; then
defaults write com.apple.remotedesktop showShortUserName -bool true
fi
# if ask "Set the maximum number of computers that can be observed: (up to 50 opposed to the default of 9)" Y; then
# defaults write com.apple.RemoteDesktop multiObserveMaxPerScreen -int 9
# fi
###############################################################################
# Screen Sharing #
###############################################################################
# if ask "Prevent protection when attempting to remotely control this computer" N; then
# defaults write com.apple.ScreenSharing skipLocalAddressCheck -bool true
# fi
# if ask "Disables system-level key combos like command-option-esc (Force Quit), command-tab (App switcher) to be used on the remote machine" N; then
# defaults write com.apple.ScreenSharing DoNotSendSystemKeys -bool true
# fi
# if ask "Debug (To Show Bonjour)" N; then
# defaults write com.apple.ScreenSharing debug -bool true
# fi
# if ask "Do Not Send Special Keys to Remote Machine" N; then
# defaults write com.apple.ScreenSharing DoNotSendSystemKeys -bool true
# fi
# if ask "Skip local address check" N; then
# defaults write com.apple.ScreenSharing skipLocalAddressCheck -bool true
# fi
# if ask "Screen sharing image quality" N; then
# defaults write com.apple.ScreenSharing controlObserveQuality -int
# fi
# if ask "Number of recent hosts on ScreenSharingMenulet" N; then
# defaults write com.klieme.ScreenSharingMenulet maxHosts -int
# fi
# if ask "Display IP-Addresses of the local hosts on ScreenSharingMenulet" N; then
# defaults write com.klieme.ScreenSharingMenulet showIPAddresses -bool true
# fi
###############################################################################
# Dock, Dashboard, and hot corners #
###############################################################################
if ask "Set the icon size of Dock items to 35 pixels" Y; then
defaults write com.apple.dock tilesize -int 35
fi
if ask "Move the dock to the right side of the screen" Y; then
defaults write com.apple.dock orientation -string "right"
fi
if ask "Minimize windows into their application's icon" Y; then
defaults write com.apple.dock "minimize-to-application" -bool true
fi
if ask "Show only active apps in Dock" Y; then
defaults write com.apple.dock "static-only" -bool true
fi
# if ask "Enable spring loading for all Dock items" Y; then
# defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true
# fi
if ask "Enable highlight hover effect for the grid view of a stack (Dock)" Y; then
defaults write com.apple.dock "mouse-over-hilte-stack" -bool true
fi
if ask "Show indicator lights for open applications in the Dock" Y; then
defaults write com.apple.dock "show-process-indicators" -bool true
fi
if ask "Animate opening applications from the Dock" Y; then
defaults write com.apple.dock launchanim -bool true
fi
if ask "Change minimize/maximize window effect" Y; then
defaults write com.apple.dock mineffect -string "suck"
fi
if ask "Speed up Mission Control animations" Y; then
defaults write com.apple.dock "expose-animation-duration" -float 0.5
fi
if ask "Don't group windows by application in Mission Control (i.e. use the old Exposé behavior instead)" N; then
defaults write com.apple.dock "expose-group-by-app" -bool false
fi
if ask "Enable Mission Control" N; then
defaults write com.apple.Dock "mcx-expose-disabled" -bool false
fi
if ask "Don't show Dashboard as a Space" N; then
defaults write com.apple.dock "dashboard-in-overlay" -bool true
fi
if ask "Show image for notifications" Y; then
defaults write com.apple.dock "notification-always-show-image" -bool true
fi
if ask "Enable the 2D Dock" N; then
defaults write com.apple.dock "no-glass" -bool true
fi
if ask "Ensable Bouncing dock icons" Y; then
defaults write com.apple.dock "no-bouncing" -bool false
fi
if ask "Disable multi-display swoosh animations" N; then
defaults write com.apple.dock "workspaces-swoosh-animation-off" -bool false
fi
if ask "Remove the animation when hiding or showing the dock" Y; then
defaults write com.apple.dock "autohide-time-modifier" -float 0
fi
if ask "Enable iTunes pop-up notifications" N; then
defaults write com.apple.dock "itunes-notifications" -boolean false
fi
# if ask "Add a 'Recent Applications' stack to the Dock" N; then
# defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }'
# fi
if ask "In Expose, only show windows from the current space" N; then
defaults write com.apple.dock "wvous-show-windows-in-other-spaces" -bool false
fi
if ask "Automatically rearrange Spaces based on most recent use" Y; then
defaults write com.apple.dock "mru-spaces" -bool true
fi
if ask "Remove the auto-hiding Dock delay" N; then
defaults write com.apple.dock "autohide-delay" -float 0
fi
if ask "Automatically hide and show the Dock" Y; then
defaults write com.apple.dock autohide -bool true
fi
if ask "Automatically magnify the Dock" Y; then
defaults write com.apple.dock magnification -bool true
fi
if ask "Make Dock icons of hidden applications translucent" Y; then
defaults write com.apple.dock showhidden -bool true
fi
if ask "Enable highlight hover effect for the grid view of a stack (Dock)" Y; then
defaults write com.apple.dock mouse-over-hilite-stack -bool true
fi
if ask "Enable the 'reopen windows when logging back in' option" Y; then
# This works, although the checkbox will still appear to be checked.
defaults write com.apple.loginwindow TALLogoutSavesState -bool true
defaults write com.apple.loginwindow LoginwindowLaunchesRelaunchApps -bool true
fi
###############################################################################
# Launchpad #
###############################################################################
if ask "Number of columns and rows in the dock springboard set to 10" Y; then
defaults write com.apple.dock springboard-rows -int 10
defaults write com.apple.dock springboard-columns -int 10
fi
# defaults write com.apple.dock ResetLaunchPad -bool true
if ask "Disable the Launchpad gesture (pinch with thumb and three fingers)" N; then
defaults write com.apple.dock showLaunchpadGestureEnabled -int 0
fi
# Add iOS & Watch Simulator to Launchpad
# sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" "/Applications/Simulator.app"
# sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator (Watch).app" "/Applications/Simulator (Watch).app"
# Add a spacer to the left side of the Dock (where the applications are)
# defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'
# Add a spacer to the right side of the Dock (where the Trash is)
# defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}'
if ask "Hot corners" Y; then
# 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 → Desktop
defaults write com.apple.dock wvous-tl-corner -int 4
defaults write com.apple.dock wvous-tl-modifier -int 0
# Bottom left screen corner → No-op
defaults write com.apple.dock wvous-bl-corner -int 0
defaults write com.apple.dock wvous-bl-modifier -int 0
# Top right screen corner → Mission Control
defaults write com.apple.dock wvous-tr-corner -int 2
defaults write com.apple.dock wvous-tr-modifier -int 0
# Bottom right screen corner → Start screen saver
defaults write com.apple.dock wvous-br-corner -int 5
defaults write com.apple.dock wvous-br-modifier -int 0
fi
###############################################################################
# Safari & WebKit #
###############################################################################
if ask "Privacy: don't send search queries to Apple" Y; then
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
fi
# if ask "Press Tab to highlight each item on a web page" N; then
# defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true
# defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true
# fi
if ask "Show the full URL in the address bar (note: this still hides the scheme)" Y; then
defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true
fi
if ask "Set Safari's home page to 'about:blank' for faster loading" Y; then
defaults write com.apple.Safari HomePage -string "about:blank"
fi
if ask "Prevent Safari from opening 'safe' files automatically after downloading" Y; then
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
fi
if ask "Allow hitting the Backspace key to go to the previous page in history" Y; then
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true
fi
if ask "Hide Safari's bookmarks bar by default" Y; then
defaults write com.apple.Safari ShowFavoritesBar -bool false
defaults write com.apple.Safari "ShowFavoritesBar-v2" -bool false
fi
if ask "Hide Safari's sidebar in Top Sites" Y; then
defaults write com.apple.Safari ShowSidebarInTopSites -bool false
fi
if ask "Disable Safari's thumbnail cache for History and Top Sites" Y; then
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
fi
if ask "Enable Safari's debug menu" Y; then
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
fi
if ask "Make Safari's search banners default to Contains instead of Starts With" Y; then
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
fi
if ask "Remove useless icons from Safari's bookmarks bar" Y; then
defaults write com.apple.Safari ProxiesInBookmarksBar "()"
fi
if ask "Warn about fraudulent websites" Y; then
defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true
fi
if ask "Block pop-up windows" Y; then
defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false
fi
if ask "Disable auto-playing video" Y; then
defaults write com.apple.Safari WebKitMediaPlaybackAllowsInline -bool false
defaults write com.apple.SafariTechnologyPreview WebKitMediaPlaybackAllowsInline -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false
defaults write com.apple.SafariTechnologyPreview com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false
fi
if ask "Enable 'Do Not Track'" Y; then
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true
fi
if ask "Enable the Develop menu and the Web Inspector in Safari" Y; then
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
fi
# Requires Safari 5.0.1 or later. Feature that is intended to increase the speed at which pages load. DNS (Domain Name System) prefetching kicks in when you load a webpage that contains links to other pages. As soon as the initial page is loaded, Safari 5.0.1 (or later) begins resolving the listed links' domain names to their IP addresses. Prefetching can occasionally result in 'slow performance, partially-loaded pages, or webpage 'cannot be found' messages.”
if ask "Increase page load speed in Safari" Y; then
defaults write com.apple.safari WebKitDNSPrefetchingEnabled -bool true
fi
if ask "Disable Data Detectors" Y; then
defaults write com.apple.Safari WebKitUsesEncodingDetector -bool false
fi
if ask "Google Suggestion" Y; then
defaults write com.apple.safari DebugSafari4IncludeGoogleSuggest -bool true
fi
if ask "Automatically spell check web forms" Y; then
defaults write com.apple.safari WebContinuousSpellCheckingEnabled -bool true
fi
if ask "Automatically grammar check web forms" Y; then
defaults write com.apple.safari WebGrammarCheckingEnabled -bool true
fi
if ask "Include page background colors and images when printing" N; then
defaults write com.apple.safari WebKitShouldPrintBackgroundsPreferenceKey -bool true
fi
if ask "Enable developer menu in Safari" Y; then
defaults write com.apple.Safari IncludeDebugMenu -bool true
fi
# Disable plug-ins
# defaults write com.apple.Safari WebKitPluginsEnabled -bool false
# defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2PluginsEnabled -bool false
# Disable Java
# defaults write com.apple.Safari WebKitJavaEnabled -bool false
# defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled -bool false
# defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabledForLocalFiles -bool false
# Block pop-up windows
# defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false
# defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false
# Disable auto-playing video
#defaults write com.apple.Safari WebKitMediaPlaybackAllowsInline -bool false
#defaults write com.apple.SafariTechnologyPreview WebKitMediaPlaybackAllowsInline -bool false
#defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false
#defaults write com.apple.SafariTechnologyPreview com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -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
###############################################################################
# Mail #
###############################################################################
# Disable send and reply animations in Mail.app
# defaults write com.apple.mail DisableReplyAnimations -bool true
# defaults write com.apple.mail DisableSendAnimations -bool true
# Copy email addresses as `foo@example.com` instead of `Foo Bar <foo@example.com>` in Mail.app
# defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
# Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app
# defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" "@\U21a9"
# Display emails in threaded mode, sorted by date (oldest at the top)
# defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes"
# defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "yes"
# defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date"
# 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"
###############################################################################