-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset-macos-defaults.sh
More file actions
executable file
·292 lines (216 loc) · 11.1 KB
/
set-macos-defaults.sh
File metadata and controls
executable file
·292 lines (216 loc) · 11.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
#!/bin/sh
# Sets reasonable macOS defaults.
#
# Or, in other words, set shit how I like in macOS.
#
# The original idea (and a couple settings) were grabbed from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# More from:
# https://gist.github.com/brandonb927/3195465
#
# Run ./set-defaults.sh and you'll be good to go.
if [ "$(uname -s)" != "Darwin" ]; then
exit 0
fi
set +e
disable_agent() {
mv "$1" "$1_DISABLED" >/dev/null 2>&1 ||
sudo mv "$1" "$1_DISABLED" >/dev/null 2>&1
}
unload_agent() {
launchctl unload -w "$1" >/dev/null 2>&1
}
sudo -v
echo ""
echo "› System:"
echo " › Disable press-and-hold for keys in favor of key repeat"
defaults write -g ApplePressAndHoldEnabled -bool false
echo " › Use AirDrop over every interface"
defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1
echo " › Show the ~/Library folder"
chflags nohidden ~/Library
echo " › Show the /Volumes folder"
sudo chflags nohidden /Volumes
echo " › Set a really fast key repeat"
defaults write NSGlobalDomain KeyRepeat -int 2
defaults write NSGlobalDomain InitialKeyRepeat -int 15
echo " › Enable text replacement almost everywhere"
defaults write -g WebAutomaticTextReplacementEnabled -bool true
echo " › Turn off keyboard illumination when computer is not used for 5 minutes"
defaults write com.apple.BezelServices kDimTime -int 300
echo " › Require password immediately after sleep or screen saver begins"
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
echo " › Always show scrollbars"
defaults write NSGlobalDomain AppleShowScrollBars -string "Always"
# Possible values: `WhenScrolling`, `Automatic` and `Always`
echo " › Disable Dashboard"
defaults write com.apple.dashboard mcx-disabled -bool true
echo " › Don't automatically rearrange Spaces based on most recent use"
defaults write com.apple.dock mru-spaces -bool false
echo " › Increase the window resize speed for Cocoa applications"
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
echo " › Disable smart quotes and smart dashes as they're annoying when typing code"
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
echo " › Disable auto-correct"
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
echo " › Set up trackpad & mouse speed to a reasonable number"
defaults write -g com.apple.trackpad.scaling 2
defaults write -g com.apple.mouse.scaling 2.5
echo " › Avoid the creation of .DS_Store files on network volumes"
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
echo " › Disable the 'Are you sure you want to open this application?' dialog"
defaults write com.apple.LaunchServices LSQuarantine -bool false
echo " › Set dark interface style"
defaults write NSGlobalDomain AppleInterfaceStyle -string "Dark"
echo " › Set graphite appearance"
defaults write NSGlobalDomain AppleAquaColorVariant -int 6
echo " › Set graphite highlight color"
defaults write NSGlobalDomain AppleHighlightColor -string "0.847059 0.847059 0.862745"
echo " › Show battery percent"
defaults write com.apple.menuextra.battery ShowPercent -bool true
echo " › Speed up wake from sleep to 24 hours from an hour"
# http://www.cultofmac.com/221392/quick-hack-speeds-up-retina-macbooks-wake-from-sleep-os-x-tips/
sudo pmset -a standbydelay 86400
echo " › Removing duplicates in the 'Open With' menu"
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister \
-kill -r -domain local -domain system -domain user
#############################
echo ""
echo "› Finder:"
echo " › Always open everything in Finder's list view"
defaults write com.apple.Finder FXPreferredViewStyle Nlsv
echo " › Set the Finder prefs for showing a few different volumes on the Desktop"
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
echo " › Expand save panel by default"
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
echo " › Set sidebar icon size to small"
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 1
echo " › Show status bar"
defaults write com.apple.finder ShowStatusBar -bool true
echo " › Show path bar"
defaults write com.apple.finder ShowPathbar -bool true
echo " › Disable the warning before emptying the Trash"
defaults write com.apple.finder WarnOnEmptyTrash -bool false
echo " › Save to disk by default, instead of iCloud"
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
echo " › Display full POSIX path as Finder window title"
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
echo " › Disable the warning when changing a file extension"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
#############################
echo ""
echo "› Photos:"
echo " › Disable it from starting everytime a device is plugged in"
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
#############################
echo ""
echo "› Browsers:"
echo " › Hide Safari's bookmark bar"
defaults write com.apple.Safari ShowFavoritesBar -bool false
echo " › Set up Safari for development"
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
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
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
echo " › Disable the annoying backswipe in Chrome"
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
#############################
echo ""
echo "› Dock"
echo " › Setting the icon size of Dock items to 45 pixels for optimal size/screen-realestate"
defaults write com.apple.dock tilesize -int 45
echo " › Speeding up Mission Control animations and grouping windows by application"
defaults write com.apple.dock expose-animation-duration -float 0.1
defaults write com.apple.dock "expose-group-by-app" -bool true
echo " › Remove the auto-hiding Dock delay"
defaults write com.apple.dock autohide-delay -float 0
echo " › Remove the animation when hiding/showing the Dock"
defaults write com.apple.dock autohide-time-modifier -float 0
echo " › Automatically hide and show the Dock"
defaults write com.apple.dock autohide -bool true
echo " › Don't animate opening applications from the Dock"
defaults write com.apple.dock launchanim -bool false
#############################
echo ""
echo "› Transmission:"
echo " › Use ~/Downloads/Incomplete to store incomplete downloads"
defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true
defaults write org.m0k.transmission IncompleteDownloadFolder -string "$HOME/Downloads/Incomplete"
echo " › Don't prompt for confirmation before downloading"
defaults write org.m0k.transmission DownloadAsk -bool false
echo " › Trash original torrent files"
defaults write org.m0k.transmission DeleteOriginalTorrent -bool true
echo " › Hide the donate message"
defaults write org.m0k.transmission WarningDonate -bool false
echo " › Hide the legal disclaimer"
defaults write org.m0k.transmission WarningLegal -bool false
echo " › Auto-add .torrent files in ~/Downloads"
defaults write org.m0k.transmission AutoImportDirectory -string "$HOME/Downloads"
echo " › Auto-resize the window to fit transfers"
defaults write org.m0k.transmission AutoSize -bool true
echo " › Auto update to betas"
defaults write org.m0k.transmission AutoUpdateBeta -bool true
echo " › Set up the best block list"
defaults write org.m0k.transmission EncryptionRequire -bool true
defaults write org.m0k.transmission BlocklistAutoUpdate -bool true
defaults write org.m0k.transmission BlocklistNew -bool true
defaults write org.m0k.transmission BlocklistURL -string "http://john.bitsurge.net/public/biglist.p2p.gz"
#############################
echo ""
echo "› Mail:"
echo " › Add the keyboard shortcut CMD + Enter to send an email"
defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" "@\U21a9"
echo " › Add the keyboard shortcut CMD + Shift + E to archive an email"
# shellcheck disable=SC2016
defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Archive" '@$e'
echo " › Disable smart quotes as it's annoying for messages that contain code"
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false
echo " › Set email addresses to copy as 'foo@example.com' instead of 'Foo Bar <foo@example.com>'"
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
echo " › 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"
echo " › Disable inline attachments (just show the icons)"
defaults write com.apple.mail DisableInlineAttachmentViewing -bool true
echo " › Disable automatic spell checking"
defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled"
echo " › Disable send and reply animations in Mail.app"
defaults write com.apple.mail DisableReplyAnimations -bool true
defaults write com.apple.mail DisableSendAnimations -bool true
#############################
echo ""
echo "› Time Machine:"
echo " › Prevent Time Machine from prompting to use new hard drives as backup volume"
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
###############################################################################
# SSD-specific tweaks #
###############################################################################
echo ""
echo "› SSD tweaks:"
echo " › Disable local backups"
# https://classicyuppie.com/what-crap-is-this-os-xs-mobilebackups/
sudo tmutil disablelocal
echo " › Disable hibernation (speeds up entering sleep mode)"
sudo pmset -a hibernatemode 0
echo " › Remove the sleep image file to save disk space"
sudo rm /private/var/vm/sleepimage
echo " › Create a zero-byte file instead..."
sudo touch /private/var/vm/sleepimage
echo " › ...and make sure it can’t be rewritten"
sudo chflags uchg /private/var/vm/sleepimage
echo " › Disable the sudden motion sensor as it’s not useful for SSDs"
sudo pmset -a sms 0
#############################
echo ""
echo "› Restart related apps"
for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \
"Dock" "Finder" "Mail" "Messages" "Safari" "SystemUIServer" \
"Terminal" "Transmission" "Photos"; do
killall "$app" >/dev/null 2>&1
done
set -e