-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sysprefs.sh
executable file
·414 lines (295 loc) · 18.2 KB
/
sysprefs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
#!/usr/bin/env bash
# h/t https://github.com/mathiasbynens/dotfiles/blob/main/.macos
# 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 and update existing `sudo` time stamp until `.macos` has finished
sudo -v
while true; do
sudo -n true
sleep 60
kill -0 "$$" || exit
done 2>/dev/null &
echo "Updating computer name..."
sudo scutil --set ComputerName "${HOSTNAME:-0xDEADBEEF}"
sudo scutil --set HostName "${HOSTNAME:-0xDEADBEEF}"
sudo scutil --set LocalHostName "${HOSTNAME:-0xDEADBEEF}"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "${HOSTNAME:-0xDEADBEEF}"
echo "Updating system configurations..."
# disable the sound effects on boot
sudo nvram SystemAudioVolume=" "
# set sidebar icon size to medium
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2
# always show scrollbars; possible values: `WhenScrolling`, `Automatic` and `Always`
defaults write NSGlobalDomain AppleShowScrollBars -string "Always"
# disable the over-the-top focus ring animation
defaults write NSGlobalDomain NSUseAnimatedFocusRing -bool false
# adjust toolbar title rollover delay
defaults write NSGlobalDomain NSToolbarTitleViewRolloverDelay -float 0
# increase window resize speed for cocoa applications
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
# expand save and panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
# automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# disable the "are you sure you want to open this application?" dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
# display ascii control characters using caret notation in standard text views
defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true
# disable resume system-wide
defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false
# disable automatic termination of inactive apps
defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true
# set help viewer windows to non-floating mode
defaults write com.apple.helpviewer DevMode -bool true
# disable automatic capitalization as it's annoying when typing code
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
# disable smart dashes as they're annoying when typing code
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# disable automatic period substitution as it's annoying when typing code
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
# disable smart quotes as they're annoying when typing code
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
# disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# enable tap to click for this user and for the login screen
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
# increase sound quality for bluetooth headphones/headsets
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
# enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# use scroll gesture with the ctrl (^) modifier key to zoom and follow the keyboard focus while zoomed in
defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true
# disable press-and-hold for keys in favor of key repeat
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain InitialKeyRepeat -int 10
# Set language and text formats
# 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 NSGlobalDomain AppleLanguages -array "en"
defaults write NSGlobalDomain AppleLocale -string "en_US@currency=USD"
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"
defaults write NSGlobalDomain AppleMetricUnits -bool true
# 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
# disable machine sleep while charging
sudo pmset -c sleep 0
# save screenshots to the desktop
mkdir -p "${HOME}/Desktop/Screenshots"
defaults write com.apple.screencapture location -string "${HOME}/Desktop/Screenshots"
# save screenshots in png format (other options: bmp, gif, jpg, pdf, tiff)
defaults write com.apple.screencapture type -string "png"
# enable subpixel font rendering on non-apple lcds (https://github.com/kevinSuttle/macOS-Defaults/issues/17#issuecomment-266633501)
defaults write NSGlobalDomain AppleFontSmoothing -int 1
# enable hidpi display modes (requires restart)
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
# show icons for hard drives, servers, and removable media on the desktop
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
# finder: show hidden files by default
defaults write com.apple.finder AppleShowAllFiles -bool true
# finder: show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# finder: show status bar
defaults write com.apple.finder ShowStatusBar -bool true
# finder: show path bar
defaults write com.apple.finder ShowPathbar -bool true
# keep folders on top when sorting by name
defaults write com.apple.finder _FXSortFoldersFirst -bool true
# when performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# enable spring loading for directories
defaults write NSGlobalDomain com.apple.springing.enabled -bool true
# remove the spring loading delay for directories
defaults write NSGlobalDomain com.apple.springing.delay -float 0
# avoid creating .DS_Store files on network or usb volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
# disable disk image verification
defaults write com.apple.frameworks.diskimages skip-verify -bool true
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
# show item info near icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/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" ~/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" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
# use list view in all finder windows by default
# four-letter codes for the other view modes: `icnv`, `clmv`, `glyv`
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# enable airdrop over ethernet and on unsupported macs running lion
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
# show the ~/library folder
chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library
# show the /volumes folder
sudo chflags nohidden /Volumes
# expand the following file info panes:
# "general", "open with", and "sharing & permissions"
defaults write com.apple.finder FXInfoPanesExpanded -dict \
General -bool true \
OpenWith -bool true \
Privileges -bool true
# enable highlight hover effect for the grid view of a stack (dock)
defaults write com.apple.dock mouse-over-hilite-stack -bool true
# enable spring loading for all dock items
defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true
# show indicator lights for open applications in the dock
defaults write com.apple.dock show-process-indicators -bool true
# speed up mission control animations
defaults write com.apple.dock expose-animation-duration -float 0.1
# don't automatically rearrange spaces based on most recent use
defaults write com.apple.dock mru-spaces -bool false
# automatically hide and show the dock
defaults write com.apple.dock autohide -bool true
# make dock icons of hidden applications translucent
defaults write com.apple.dock showhidden -bool true
# don't show recent applications in dock
defaults write com.apple.dock show-recents -bool false
# reset launchpad, but keep the desktop wallpaper intact
find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete
# privacy: don't send search queries to apple
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
# press tab to highlight each item on a web page
defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true
# show the full url in the address bar (note: this still hides the scheme)
defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true
# set safari's home page to `about:blank` for faster loading
defaults write com.apple.Safari HomePage -string "about:blank"
# prevent safari from opening 'safe' files automatically after downloading
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
# hide safari's bookmarks bar by default
defaults write com.apple.Safari ShowFavoritesBar -bool false
# hide safari's sidebar in top sites
defaults write com.apple.Safari ShowSidebarInTopSites -bool false
# disable safari's thumbnail cache for history and top sites
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
# enable safari's debug menu
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
# make safari's search banners default to contains instead of starts with
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
# remove useless icons from safari's bookmarks bar
defaults write com.apple.Safari ProxiesInBookmarksBar "()"
# enable the develop menu and the web inspector in safari
defaults write com.apple.Safari IncludeDevelopMenu -bool true
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true
# add a context menu item for showing the web inspector in web views
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
# enable continuous spellchecking
defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool true
# disable auto-correct
defaults write com.apple.Safari WebAutomaticSpellingCorrectionEnabled -bool false
# disable autofill
defaults write com.apple.Safari AutoFillFromAddressBook -bool false
defaults write com.apple.Safari AutoFillPasswords -bool false
defaults write com.apple.Safari AutoFillCreditCardData -bool false
defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false
# warn about fraudulent websites
defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true
# block pop-up windows
defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false
# 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
# copy email addresses as `[email protected]` instead of `foo bar <[email protected]>` 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"
# hide spotlight tray-icon (and subsequent helper)
sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search
# disable spotlight indexing for any volume that gets mounted and has not yet been indexed before.
# use `sudo mdutil -i off "/volumes/foo"` to stop indexing any volume.
sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes"
# only use utf-8 in terminal.app
defaults write com.apple.terminal StringEncodings -array 4
# enable secure keyboard entry in terminal.app (https://security.stackexchange.com/a/47786/8918)
defaults write com.apple.terminal SecureKeyboardEntry -bool true
# disable the annoying line marks
defaults write com.apple.Terminal ShowLineMarks -int 0
# prevent time machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# disable local time machine backups
hash tmutil &>/dev/null && sudo tmutil disablelocal
# show the main window when launching activity monitor
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
# show all processes in activity monitor
defaults write com.apple.ActivityMonitor ShowCategory -int 0
# enable the debug menu in address book
defaults write com.apple.addressbook ABShowDebugMenu -bool true
# enable dashboard dev mode (allows keeping widgets on the desktop)
defaults write com.apple.dashboard devmode -bool true
# enable the debug menu in ical (pre-10.8)
defaults write com.apple.iCal IncludeDebugMenu -bool true
# use plain text mode for new textedit documents
defaults write com.apple.TextEdit RichText -int 0
# open and save files as utf-8 in textedit
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
# enable the debug menu in disk utility
defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true
defaults write com.apple.DiskUtility advanced-image-options -bool true
# enable the webkit developer tools in the mac app store
defaults write com.apple.appstore WebKitDeveloperExtras -bool true
# enable debug menu in the mac app store
defaults write com.apple.appstore ShowDebugMenu -bool true
# enable the automatic update check
defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true
# check for software updates daily, not just once per week
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
# install system data files & security updates
defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1
# prevent the app store to reboot machine on macos updates
defaults write com.apple.commerce AutoUpdateRestartRequired -bool false
# prevent photos from opening automatically when devices are plugged in
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
# disable smart quotes as it's annoying for messages that contain code
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false
# disable continuous spell checking
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false
# use the system-native print preview dialog
defaults write com.google.Chrome DisablePrintPreview -bool true
defaults write com.google.Chrome.dev DisablePrintPreview -bool true
# expand the print dialog by default
defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true
defaults write com.google.Chrome.dev PMPrintingExpandedStateForPrint2 -bool true
# disable signing emails by default
defaults write ~/Library/Preferences/org.gpgtools.gpgmail SignNewEmailsByDefault -bool false
echo "Done! ✨"