1
+ #### This file is for applying MacOS configurations
2
+
3
+ # Close any open System Preferences panes, to prevent them from overriding
4
+ # settings we’re about to change
5
+ osascript -e 'tell application "System Preferences" to quit'
6
+
7
+ ###############################################################################
8
+ # General UI/UX #
9
+ ###############################################################################
10
+
11
+ # Disable smart quotes as they’re annoying when typing code
12
+ defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
13
+
14
+ # Disable smart dashes as they’re annoying when typing code
15
+ defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
16
+
17
+ # Save to disk (not to iCloud) by default
18
+ defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
19
+
20
+ # Disable Resume system-wide
21
+ defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false
22
+
23
+ # Restart automatically if the computer freezes
24
+ sudo systemsetup -setrestartfreeze on
25
+
26
+ ###############################################################################
27
+ # SSD-specific tweaks #
28
+ ###############################################################################
29
+
30
+ # Disable hibernation (speeds up entering sleep mode)
31
+ sudo pmset -a hibernatemode 0
32
+
33
+ # Remove the sleep image file to save disk space
34
+ sudo rm /private/var/vm/sleepimage
35
+ # Create a zero-byte file instead…
36
+ sudo touch /private/var/vm/sleepimage
37
+ # …and make sure it can’t be rewritten
38
+ sudo chflags uchg /private/var/vm/sleepimage
39
+
40
+ # Disable the sudden motion sensor as it’s not useful for SSDs
41
+ sudo pmset -a sms 0
42
+
43
+ ###############################################################################
44
+ # Trackpad, mouse, keyboard, Bluetooth accessories, and input #
45
+ ###############################################################################
46
+
47
+ # Enable swap between full screen apps with 4 fingers swipe (so that I can use the 3 fingers bellow)
48
+ defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerHorizSwipeGesture -int 0
49
+ # Enable select text with three fingers drag
50
+ defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerDrag -int 1
51
+
52
+ # Use scroll gesture with the Ctrl (^) modifier key to zoom
53
+ defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
54
+ defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
55
+
56
+ # Follow the keyboard focus while zoomed in
57
+ defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true
58
+
59
+ # Trackpad: enable tap to click for this user and for the login screen
60
+ defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
61
+ defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
62
+ defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
63
+
64
+ # Enable full keyboard access for all controls
65
+ # (e.g. enable Tab in modal dialogs)
66
+ defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
67
+
68
+ # Disable auto-correct
69
+ defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
70
+
71
+ ###############################################################################
72
+ # Screen #
73
+ ###############################################################################
74
+
75
+ # Require password immediately after sleep or screen saver begins
76
+ defaults write com.apple.screensaver askForPassword -int 1
77
+ defaults write com.apple.screensaver askForPasswordDelay -int 0
78
+
79
+ # Save screenshots to the desktop
80
+ defaults write com.apple.screencapture location -string "${HOME}/Desktop"
81
+
82
+ # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
83
+ defaults write com.apple.screencapture type -string "png"
84
+
85
+ # Disable shadow in screenshots
86
+ defaults write com.apple.screencapture disable-shadow -bool true
87
+
88
+ ###############################################################################
89
+ # Finder #
90
+ ###############################################################################
91
+
92
+ # Finder: disable window animations and Get Info animations
93
+ defaults write com.apple.finder DisableAllAnimations -bool true
94
+
95
+ # Set Desktop as the default location for new Finder windows
96
+ # For other paths, use `PfLo` and `file:///full/path/here/`
97
+ defaults write com.apple.finder NewWindowTarget -string "PfDe"
98
+ defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/"
99
+
100
+ # Finder: show hidden files by default
101
+ defaults write com.apple.finder AppleShowAllFiles -bool true
102
+
103
+ # Finder: show all filename extensions
104
+ defaults write NSGlobalDomain AppleShowAllExtensions -bool true
105
+
106
+ # Finder: show status bar
107
+ defaults write com.apple.finder ShowStatusBar -bool true
108
+
109
+ # Finder: show path bar
110
+ defaults write com.apple.finder ShowPathbar -bool true
111
+
112
+ # Display full POSIX path as Finder window title
113
+ defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
114
+
115
+ # Keep folders on top when sorting by name
116
+ defaults write com.apple.finder _FXSortFoldersFirst -bool true
117
+
118
+ # When performing a search, search the current folder by default
119
+ defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
120
+
121
+ # Disable the warning when changing a file extension
122
+ defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
123
+
124
+ # Enable spring loading for directories
125
+ defaults write NSGlobalDomain com.apple.springing.enabled -bool true
126
+
127
+ # Remove the spring loading delay for directories
128
+ defaults write NSGlobalDomain com.apple.springing.delay -float 0
129
+
130
+ # Avoid creating .DS_Store files on network or USB volumes
131
+ defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
132
+ defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
133
+
134
+ # Disable disk image verification
135
+ defaults write com.apple.frameworks.diskimages skip-verify -bool true
136
+ defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
137
+ defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
138
+
139
+ # Use list view in all Finder windows by default
140
+ # Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
141
+ defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
142
+
143
+ # Disable the warning before emptying the Trash
144
+ defaults write com.apple.finder WarnOnEmptyTrash -bool false
145
+
146
+ # Show the ~/Library folder
147
+ chflags nohidden ~/Library
148
+
149
+ ###############################################################################
150
+ # Dock, Dashboard, and hot corners #
151
+ ###############################################################################
152
+
153
+ # Enable highlight hover effect for the grid view of a stack (Dock)
154
+ defaults write com.apple.dock mouse-over-hilite-stack -bool true
155
+
156
+ # Set the icon size of Dock items to 36 pixels
157
+ defaults write com.apple.dock tilesize -int 36
158
+
159
+ # Change minimize/maximize window effect
160
+ defaults write com.apple.dock mineffect -string "scale"
161
+
162
+ # Minimize windows into their application’s icon
163
+ defaults write com.apple.dock minimize-to-application -bool true
164
+
165
+ # Wipe all (default) app icons from the Dock
166
+ # This is only really useful when setting up a new Mac, or if you don’t use
167
+ # the Dock to launch apps. I personally always launch apps from Spotlight Search.
168
+ defaults write com.apple.dock persistent-apps -array
169
+
170
+ # Show only open applications in the Dock
171
+ defaults write com.apple.dock static-only -bool true
172
+
173
+ # Don’t animate opening applications from the Dock
174
+ defaults write com.apple.dock launchanim -bool false
175
+
176
+ # Speed up Mission Control animations
177
+ defaults write com.apple.dock expose-animation-duration -float 0.1
178
+
179
+ # Don’t group windows by application in Mission Control
180
+ # (i.e. use the old Exposé behavior instead)
181
+ defaults write com.apple.dock expose-group-by-app -bool false
182
+
183
+ # Disable Dashboard
184
+ defaults write com.apple.dashboard mcx-disabled -bool true
185
+
186
+ # Don’t show Dashboard as a Space
187
+ defaults write com.apple.dock dashboard-in-overlay -bool true
188
+
189
+ # Don’t automatically rearrange Spaces based on most recent use
190
+ defaults write com.apple.dock mru-spaces -bool false
191
+
192
+ # Remove the auto-hiding Dock delay
193
+ defaults write com.apple.dock autohide-delay -float 0
194
+ # Remove the animation when hiding/showing the Dock
195
+ defaults write com.apple.dock autohide-time-modifier -float 0
196
+
197
+ # Automatically hide and show the Dock
198
+ defaults write com.apple.dock autohide -bool true
199
+
200
+ # Make Dock icons of hidden applications translucent
201
+ defaults write com.apple.dock showhidden -bool true
202
+
203
+ ###############################################################################
204
+ # Terminal #
205
+ ###############################################################################
206
+
207
+ # Enable Secure Keyboard Entry in Terminal.app
208
+ # See: https://security.stackexchange.com/a/47786/8918
209
+ defaults write com.apple.terminal SecureKeyboardEntry -bool true
210
+
211
+ ###############################################################################
212
+ # Time Machine #
213
+ ###############################################################################
214
+
215
+ # Prevent Time Machine from prompting to use new hard drives as backup volume
216
+ defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
217
+
218
+ # Disable local Time Machine backups
219
+ hash tmutil &> /dev/null && sudo tmutil disablelocal
220
+
221
+ ###############################################################################
222
+ # Activity Monitor #
223
+ ###############################################################################
224
+
225
+ # Show the main window when launching Activity Monitor
226
+ defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
227
+
228
+ # Visualize CPU usage in the Activity Monitor Dock icon
229
+ defaults write com.apple.ActivityMonitor IconType -int 5
230
+
231
+ # Show all processes in Activity Monitor
232
+ defaults write com.apple.ActivityMonitor ShowCategory -int 0
233
+
234
+ # Sort Activity Monitor results by CPU usage
235
+ defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
236
+ defaults write com.apple.ActivityMonitor SortDirection -int 0
237
+
238
+ ###############################################################################
239
+ # Photos #
240
+ ###############################################################################
241
+
242
+ # Prevent Photos from opening automatically when devices are plugged in
243
+ defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
244
+
245
+ echo "Done. Note that some of these changes require a logout/restart to take effect."
0 commit comments