1111
1212# macOS settings
1313if [[ " ${OSTYPE:- } " == " darwin" * ]]; then
14+ if ! command -v plistwatch & > /dev/null && command -v go & > /dev/null; then
15+ plistwatch () {
16+ go install github.com/catilac/plistwatch@latest
17+ unset -f " $0 "
18+ $0 " $@ "
19+ }
20+ fi
21+
1422 if ! sudo -n true & > /dev/null; then
1523 echo -e " \033[1;33mWARN:\033[0m you may be asked for your password to run 'pmset', 'chflags', and other utilities\n"
1624 fi
@@ -21,38 +29,41 @@ if [[ "${OSTYPE:-}" == "darwin"* ]]; then
2129
2230 # ***** Settings > Network *****
2331
24- # ***** Settings > Notifications *****
25-
26- # ***** Settings > Sound *****
27- # Alert sound: Boop
28- defaults write .GlobalPreferences com.apple.sound.beep.sound -string " /System/Library/Sounds/Tink.aiff"
29- # Alert volume
30- defaults write .GlobalPreferences com.apple.sound.beep.volume -float 0.5
31- # Play feedback when volume is changed
32- defaults write .GlobalPreferences com.apple.sound.beep.feedback -bool true
33-
34- # ***** Settings > Focus *****
35- # TODO: remove DND schedules / disable DND
32+ # ***** Settings > Battery *****
33+ # Low Power Mode: Only on Battery
34+ sudo pmset -b lowpowermode 1
35+ sudo pmset -c lowpowermode 0
36+ # Options... prevent automatic sleeping on power adapter when the display is off: on
37+ sudo pmset -c sleep 0
38+ # Options... wake for network access: only on power adapter
39+ sudo pmset -b womp 0
40+ sudo pmset -c womp 1
3641
37- # ***** Settings > Screen Time *****
42+ # ***** Settings > Apple Intelligence & Siri *****
43+ # Siri: off
44+ defaults write com.apple.assistant.support " Assistant Enabled" -int 0
3845
3946 # ***** Settings > General > Software Update *****
4047 # sudo softwareupdate --schedule ON
4148 # sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist AutomaticCheckEnabled -bool YES
4249
50+ # ***** Settings > General > Date & Time *****
51+ # 24-hour time: on
52+ defaults write .GlobalPreferences AppleICUForce24HourTime -int 1
53+
54+ # ***** Settings > Accessibility *****
55+
4356 # ***** Settings > Appearance *****
4457 # NOTE: appearance change requires restart
4558 # Appearance
4659 defaults write .GlobalPreferences AppleInterfaceStyle -string " Dark"
4760 defaults write .GlobalPreferences AppleInterfaceStyleSwitchesAutomatically -bool false
48- # Accent color : orange
61+ # Color : orange
4962 defaults write .GlobalPreferences AppleAccentColor 1
5063 # Show scroll bars: always
5164 defaults write .GlobalPreferences AppleShowScrollBars -string " Always"
5265
53- # ***** Settings > Accessibility *****
54-
55- # ***** Settings > Control Center *****
66+ # ***** Settings > Menu Bar *****
5667 # Bluetooth: always show in menu bar
5768 defaults -currentHost write com.apple.controlcenter Bluetooth -int 18
5869 # Sound: always show in menu bar
@@ -61,17 +72,10 @@ if [[ "${OSTYPE:-}" == "darwin"* ]]; then
6172 defaults -currentHost write com.apple.controlcenter BatteryShowPercentage -bool true
6273 # Clock options... show AM/PM: false
6374 defaults write com.apple.menuextra.clock Show24Hour -int 1
64- defaults write .GlobalPreferences AppleICUForce24HourTime -int 1
6575 # Siri: don't show in menu bar
6676 defaults write com.apple.Siri StatusMenuVisible -int 0
6777 killall SystemUIServer
6878
69- # ***** Settings > Siri & Spotlight *****
70- # Ask Siri: false
71- defaults write com.apple.assistant.support " Assistant Enabled" -int 0
72-
73- # ***** Settings > Privacy & Security *****
74-
7579 # ***** Settings > Desktop & Dock *****
7680 # Size: smaller
7781 defaults write com.apple.dock tilesize -int 45
@@ -94,23 +98,40 @@ if [[ "${OSTYPE:-}" == "darwin"* ]]; then
9498 # TODO: True Tone off
9599 # TODO: Night Shift... schedule: sunset to sunrise
96100
101+ # ***** Settings > Spotlight *****
102+ # Disable Spotlight indexing on external volumes
103+ while read -r volume; do
104+ if mdutil -s " ${volume} " | grep -xq " enabled" ; then
105+ sudo mdutil -i off -d " ${volume} "
106+ sudo killall DesktopServicesHelper
107+ sudo killall mds
108+ sudo killall mdsync
109+ fi
110+ if [[ ! -f " ${volume} /.metadata_never_index" ]]; then
111+ touch " ${volume} /.metadata_never_index" || true
112+ fi
113+ done <<< " $(find /Volumes -type d -mindepth 1 -maxdepth 1)"
114+
97115 # ***** Settings > Wallpaper *****
98116
99- # ***** Settings > Screen Saver *****
100- # defaults -currentHost write com.apple.screensaver idleTime -int 1800
101- # defaults write com.apple.screensaver askForPasswordDelay -int 0
117+ # ***** Settings > Notifications *****
102118
103- # ***** Settings > Battery *****
104- # Low Power Mode: Only on Battery
105- sudo pmset -b lowpowermode 1
106- sudo pmset -c lowpowermode 0
107- # Options... prevent automatic sleeping on power adapter when the display is off: on
108- sudo pmset -c sleep 0
109- # Options... wake for network access: only on power adapter
110- sudo pmset -b womp 0
111- sudo pmset -c womp 1
119+ # ***** Settings > Sound *****
120+ # Alert sound: Boop
121+ defaults write .GlobalPreferences com.apple.sound.beep.sound -string " /System/Library/Sounds/Tink.aiff"
122+ # Alert volume
123+ defaults write .GlobalPreferences com.apple.sound.beep.volume -float 0.5
124+ # Play feedback when volume is changed
125+ defaults write .GlobalPreferences com.apple.sound.beep.feedback -bool true
126+
127+ # ***** Settings > Focus *****
128+ # TODO: remove DND schedules / disable DND
129+
130+ # ***** Settings > Screen Time *****
112131
113132 # ***** Settings > Lock Screen *****
133+ # defaults -currentHost write com.apple.screensaver idleTime -int 1800
134+ # defaults write com.apple.screensaver askForPasswordDelay -int 0
114135 # Start screen saver when inactive for X seconds
115136 defaults -currentHost write com.apple.screensaver -int 300
116137 # Turn display off on battery when inctive for X minutes
@@ -120,16 +141,18 @@ if [[ "${OSTYPE:-}" == "darwin"* ]]; then
120141 # TODO: Require password after screen saver begins or display is turned off: 1min
121142 killall " System Settings" || true
122143
144+ # ***** Settings > Privacy & Security *****
145+
123146 # ***** Settings > Touch ID & Password *****
124147
125148 # ***** Settings > Users & Groups *****
126149
127- # ***** Settings > Passwords *****
128-
129150 # ***** Settings > Internet Accounts *****
130151
131152 # ***** Settings > Game Center *****
132153
154+ # ***** Settings > Game Center *****
155+
133156 # ***** Settings > Wallet & Apple Pay *****
134157
135158 # ***** Settings > Keyboard *****
@@ -154,6 +177,10 @@ if [[ "${OSTYPE:-}" == "darwin"* ]]; then
154177 # More gestures... app exposé: swipe down with three fingers
155178 defaults write com.apple.dock showAppExposeGestureEnabled -bool true
156179
180+ # ***** Settings > Game Controllers *****
181+
182+ # ***** Settings > Printers & Scanners *****
183+
157184 # ***** Activity Monitor *****
158185 # Columns & sorting preferences
159186 defaults write com.apple.ActivityMonitor UserColumnSortPerTab " {0={direction=1;sort=Command;};1={direction=0;sort=anonymousMemory;};2={direction=0;sort=12HRPower;};3={direction=0;sort=CPUUsage;};4={direction=0;sort=txBytes;};5={direction=0;sort=Name;};6={direction=0;sort=GPUUsage;};}"
0 commit comments