-
Notifications
You must be signed in to change notification settings - Fork 2
/
defaults
executable file
·346 lines (260 loc) · 13.6 KB
/
defaults
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
#!/usr/bin/env bash
set -euo pipefail
. "$(dirname "$0")"/../stow/bin/.lib
ebox "Let's go!"
# --------------------------------------------------
eok "Closing System Preferences window"
osascript -e 'tell application "System Preferences" to quit'
# --------------------------------------------------
_COMPUTER_NAME=$(scutil --get ComputerName)
echo -n "Set computer name [$_COMPUTER_NAME]: "
read -r COMPUTER_NAME
if [ "$COMPUTER_NAME" != "" ] && [ "$COMPUTER_NAME" != "$_COMPUTER_NAME" ]; then
ebox "Set ComputerName to: $COMPUTER_NAME"
sudo scutil --set ComputerName "$COMPUTER_NAME"
sudo scutil --set HostName "$COMPUTER_NAME"
sudo scutil --set LocalHostName "$COMPUTER_NAME"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$COMPUTER_NAME"
eok "Set computer name (as done via System Preferences → Sharing)"
fi
# --------------------------------------------------
ebox "Tools and Look"
defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600"
eok "Set highlight color to green"
# --------------------------------------------------
ebox "Top bar"
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null
eok "Disable Notification Center and remove the menu bar icon"
defaults write com.apple.menuextra.battery ShowPercent -string 'YES'
eok "Show battery percentage"
defaults write NSGlobalDomain NSToolbarTitleViewRolloverDelay -float 0
eok "Adjust toolbar title rollover delay"
# --------------------------------------------------
ebox "Finder"
defaults write com.apple.finder WarnOnEmptyTrash -bool false
eok "Trash: disable warning on empty"
defaults write com.apple.finder _FXSortFoldersFirst -bool true
eok "Keep folders on top when sorting by name"
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
eok "When performing a search, search the current folder by default"
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false
defaults write com.apple.finder NewWindowTarget -string PfHm
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
defaults write com.apple.finder QuitMenuItem -bool true
eok "Finder fine tuning"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
eok "Disable the warning when changing a file extension"
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
eok "Disable opening and closing window animations"
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
eok "Expand save panel by default"
defaults write com.apple.finder DisableAllAnimations -bool true
eok "Finder: disable window animations and Get Info animations"
# --------------------------------------------------
ebox "Audio"
sudo nvram SystemAudioVolume=" "
sudo nvram StartupMute=%01
eok "Disable startup sound"
defaults write com.apple.sound.beep.feedback -bool false
eok "Disable audio feedback when volume is changed"
defaults write "Apple Global Domain" "com.apple.sound.beep.volume" -float 0
eok "Disable audio feedback beeps"
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
eok "Increase sound quality for Bluetooth headphones/headsets"
# --------------------------------------------------
ebox "Keyboard"
defaults write -g KeyRepeat -int 1
defaults write -g InitialKeyRepeat -int 15
eok "Keyboard: fast repeat"
defaults write -g ApplePressAndHoldEnabled -bool false
eok "Keyboard: disable letter popup on hold"
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
eok "Disable press-and-hold for keys in favor of key repeat"
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
eok "Disable smart quotes and dashes as they’re annoying when typing code"
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
defaults write NSGlobalDomain WebAutomaticSpellingCorrectionEnabled -bool false
eok "Disable auto-correct"
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
eok "Enable full keyboard access for all controls"
launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null
eok "Stop iTunes from responding to the keyboard media keys"
# --------------------------------------------------
ebox "Trackpad"
defaults write com.apple.AppleMultitouchTrackpad ForceSuppressed -bool true
eok "Trackpad: disable Fore Click haptic feedback"
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad DragLock -bool false
defaults write com.apple.AppleMultitouchTrackpad DragLock -bool false
eok "Trackpad: disable DragLock"
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Dragging -bool false
defaults write com.apple.AppleMultitouchTrackpad Dragging -bool false
eok "Trackpad: disable Dragging"
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerDrag -bool false
defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerDrag -bool false
eok "Trackpad: three finger drag"
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true
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
eok "Trackpad: enable tap to click for this user and for the login screen"
defaults write .GlobalPreferences com.apple.trackpad.scaling 2
eok "Trackpad: Faster pointer"
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
defaults write com.apple.AppleMultitouchTrackpad TrackpadRightClick -int 1
defaults -currentHost write -g com.apple.trackpad.enableSecondaryClick -bool true
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 0
defaults write com.apple.AppleMultitouchTrackpad TrackpadCornerSecondaryClick -int 0
defaults -currentHost write -g com.apple.trackpad.trackpadCornerClickBehavior -int 0
eok "Map 'click or tap with two fingers' to the secondary click"
# --------------------------------------------------
ebox "SecOps"
eask "Enable FileVault"
sudo fdesetup enable || true
eok "Enable FileVault"
eok "Disable captive control"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.captive.control Active -bool false
eask "Enable firewall"
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setloggingmode on
eok "Enable firewall"
eask "Disable time machine"
sudo tmutil disable || true
eok "Disable time machine"
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
eok "Prevent Time Machine from prompting to use new hard drives as backup volume"
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
eok "Require password immediately after sleep or screen saver begins"
# --------------------------------------------------
ebox "Photos"
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
eok "Prevent Photos from opening automatically when devices are plugged in"
# --------------------------------------------------
ebox "Screen"
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
eok "Enable HiDPI display modes (requires restart)"
sudo defaults write com.apple.universalaccess reduceMotion -bool true
eok "instead of sliding entire screen left/right, cross-fade... less jarring"
sudo defaults write com.apple.universalaccess reduceTransparency -bool true
eok "Make menubar always white (and turn off transparency everywhere)"
# --------------------------------------------------
ebox "Dock"
defaults write com.Apple.Dock showLaunchpadGestureEnabled -bool false
eok "Disable launchpad finger swipes"
defaults write com.Apple.Dock showAppExposeGestureEnabled -bool false
eok "Disable expose finger swipes"
defaults write com.Apple.Dock show-recents -bool false
eok "Don't show recently used applications in the Dock"
defaults write com.apple.dock magnification -int 1
defaults write com.apple.dock largesize -int 50
eok "Dock: magnify"
defaults write com.apple.dock persistent-apps -array
defaults write com.apple.dock persistent-others -array
eok "Dock: remove all app icons"
defaults write com.apple.dock showhidden -bool true
defaults write com.apple.dock tilesize -int 22
eok "Dock: hidden icons are transparent and small"
defaults write com.apple.dock orientation -string 'right'
eok "Dock: position right"
defaults write com.apple.dock show-process-indicators -bool FALSE
eok "Do not show app indicators in Dock"
# --------------------------------------------------
ebox "In's and Out's"
eok "Hammerspoon XDG Location"
defaults write org.hammerspoon.Hammerspoon MJConfigFile -string "~/.config/.hammerspoon/init.lua"
defaults write -g NSAutomaticCapitalizationEnabled -bool false
defaults write -g NSAutomaticDashSubstitutionEnabled -bool false
defaults write -g NSAutomaticPeriodSubstitutionEnabled -bool false
defaults write -g NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false
defaults write -g NSAutomaticTextCompletionEnabled -bool false
eok "Disable autocorrect and key substitutions"
defaults write com.apple.ActivityMonitor ShowCategory -int 0
eok "Show all processes in Activity Monitor"
sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "I AM SERIOUS"
eok "Set login screen welcome text"
sudo defaults write /Library/Preferences/com.apple.alf allowdownloadsignedenabled -bool false || true
eok "Disable automatic signed software whitelisting"
sudo defaults write /Library/Preferences/com.apple.alf allowsignedenabled -bool false || true
eok "Disable automatic software whitelisting"
sudo defaults write /Library/Preferences/com.apple.loginwindow DisableConsoleAccess -bool true
eok "Disable console logon from the logon screen"
sudo /usr/libexec/PlistBuddy -c "Set 'AC Power':'Display Sleep Timer' 5" /Library/Preferences/com.apple.PowerManagement.plist
eok "AC display sleep timer"
#sudo /usr/libexec/PlistBuddy -c "Set 'Battery Power':'Display Sleep Timer' 2" /Library/Preferences/com.apple.PowerManagement.plist
#eok "Battery display sleep timer"
defaults write com.apple.dock mru-spaces -bool false
eok "Don’t automatically rearrange Spaces based on most recent use"
defaults write com.apple.dock wvous-tl-corner -int 0
defaults write com.apple.dock wvous-tr-corner -int 0
defaults write com.apple.dock wvous-bl-corner -int 0
defaults write com.apple.dock wvous-br-corner -int 0
eok "Disable hot corners"
defaults write com.apple.dock expose-animation-duration -float 0.1
eok "Speed up Mission Control animations"
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
eok "Save to disk (not to iCloud) by default"
defaults write com.apple.CrashReporter DialogType -string "none"
eok "Disable the crash reporter"
defaults write NSGlobalDomain AppleFontSmoothing -int 2
eok "Enable subpixel font rendering on non-Apple LCDs"
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
eok "Avoid creating .DS_Store files on network or USB volumes"
sudo pmset -a sms 0
eok "Disable the sudden motion sensor as it’s not useful for SSDs"
defaults write com.apple.AdLib allowApplePersonalizedAdvertising -int 0
eok "advertising"
# --------------------------------------------------
ebox "Spotlight"
defaults write com.apple.spotlight orderedItems -array \
'{"enabled" = 1;"name" = "APPLICATIONS";}' \
'{"enabled" = 1;"name" = "MENU_EXPRESSION";}' \
'{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}' \
'{"enabled" = 0;"name" = "MENU_CONVERSION";}' \
'{"enabled" = 0;"name" = "MENU_DEFINITION";}' \
'{"enabled" = 0;"name" = "SYSTEM_PREFS";}' \
'{"enabled" = 0;"name" = "DOCUMENTS";}' \
'{"enabled" = 0;"name" = "DIRECTORIES";}' \
'{"enabled" = 0;"name" = "PRESENTATIONS";}' \
'{"enabled" = 0;"name" = "SPREADSHEETS";}' \
'{"enabled" = 0;"name" = "PDF";}' \
'{"enabled" = 0;"name" = "MESSAGES";}' \
'{"enabled" = 0;"name" = "CONTACT";}' \
'{"enabled" = 0;"name" = "EVENT_TODO";}' \
'{"enabled" = 0;"name" = "IMAGES";}' \
'{"enabled" = 0;"name" = "BOOKMARKS";}' \
'{"enabled" = 0;"name" = "MUSIC";}' \
'{"enabled" = 0;"name" = "MOVIES";}' \
'{"enabled" = 0;"name" = "FONTS";}' \
'{"enabled" = 0;"name" = "MENU_OTHER";}'
eok "Disable spotlight bloat"
# Restart spotlight
# --------------------------------------------------
ebox "Finishup, cleanup and restart"
killall "SystemUIServer" > /dev/null 2>&1 || true
eok "kill: SystemUiServer"
killall "Finder" > /dev/null 2>&1 || true
eok "kill: Finder"
killall "Dock" > /dev/null 2>&1 || true
eok "kill: Dock"
killall mds > /dev/null 2>&1 || true
eok "kill: Spotlight"
# Make sure indexing is enabled for the main volume
sudo mdutil -i on / > /dev/null 2>&1 || true
eok "revive: Spotlight"
# Rebuild the index from scratch
sudo mdutil -E / > /dev/null 2>&1 || true
eok "Spotlight - reindex"
# Starting with Mac OS X Mavericks preferences are cached,
# so in order for things to get properly set using `PlistBuddy`,
# the `cfprefsd` process also needs to be killed.
#
# https://github.com/alrra/dotfiles/commit/035dda057ddc6013ba21db3d2c30eeb51ba8f200
killall "cfprefsd" > /dev/null 2>&1 || true
eok "kill: cached preferences"
ebox "You probably want to restart your machine now...."
eok "all done!"