-
Notifications
You must be signed in to change notification settings - Fork 1
/
macos
executable file
·320 lines (215 loc) · 9.88 KB
/
macos
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
#!/usr/bin/env bash
source "$(dirname "$0")/utility"
superuser
# Close any open System Preferences panes to prevent overriding
osascript -e "tell application \"System Preferences\" to quit"
# Check whether Terminal has Full Disk Access
if [[ ! -r "/Library/Application Support/com.apple.TCC/TCC.db" ]]; then
divider
echo "⚠️ Full Disk Access must be granted to Terminal in order to run this script"
open "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles"
exit
fi
divider
echo "⚙️ Processing configuration:"
echo "> General UI/UX"
# General UI/UX
# Disable the sound effects on boot
sudo nvram SystemAudioVolume=" "
# Require password immediately after sleep or screen saver begins
defaults write com.apple.screensaver askForPassword -bool true
defaults write com.apple.screensaver askForPasswordDelay -int 0
# Show battery percentage in menu bar
defaults write com.apple.menuextra.battery ShowPercent -bool true
# Set sidebar icon size to small
defaults write -g NSTableViewDefaultSizeMode -int 1
# Expand save panel by default
defaults write -g NSNavPanelExpandedStateForSaveMode -bool true
# Expand print panel by default
defaults write -g PMPrintingExpandedStateForPrint -bool true
# Automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# Disable smart substitutions as they’re annoying when typing code
defaults write -g NSAutomaticDashSubstitutionEnabled -bool false
defaults write -g NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write -g NSAutomaticPeriodSubstitutionEnabled -bool false
# Disable automatic capitalisation as it’s annoying when typing code
defaults write -g NSAutomaticCapitalizationEnabled -bool false
# Disable the "Are you sure you want to open this application?" dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
# Reveal IP address, hostname, OS version, etc. when clicking the clock in the login window
sudo defaults write "/Library/Preferences/com.apple.loginwindow" AdminHostInfo HostName
echo "> Trackpad, Mouse, Keyboard and Input"
# Trackpad, Mouse, Keyboard and Input
# Enable tap to click
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true
defaults write -g com.apple.mouse.tapBehavior -bool true
# Set trackpad/mouse tracking speed
defaults write -g com.apple.trackpad.scaling 3
defaults write -g com.apple.mouse.scaling 5
echo "> Energy Saving"
# Energy Saving
# Enable lid wakeup
sudo pmset -a lidwake 1 &> /dev/null
# Restart automatically on power loss
sudo pmset -a autorestart 1 &> /dev/null
# Sleep the display after 15 minutes
sudo pmset -a displaysleep 15 &> /dev/null
# Disable machine sleep while charging
sudo pmset -c sleep 0 &> /dev/null
# Set machine sleep to 5 minutes on battery
sudo pmset -b sleep 5 &> /dev/null
# Set standby delay to 24 hours (default is 1 hour)
sudo pmset -a standbydelay 86400 &> /dev/null
# Never go into computer sleep mode
sudo systemsetup -setcomputersleep off &> /dev/null
# Restart automatically if the computer freezes
sudo systemsetup -setrestartfreeze on &> /dev/null
echo "> Dock and Hot Corners"
# Dock and Hot Corners
# Purge default Dock applications
defaults write com.apple.dock persistent-apps -array
# Set the icon size of Dock items
defaults write com.apple.dock tilesize -int 40
defaults write com.apple.Dock size-immutable -bool true
# Disable Dock item magnification
defaults write com.apple.dock magnification -bool false
# Minimize windows into their application’s icon
defaults write com.apple.dock minimize-to-application -bool true
# Disable recent applications in Dock
defaults write com.apple.dock show-recents -bool false
# Enable spring loading for all Dock items
defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true
# Set top right screen hot corner to Desktop
defaults write com.apple.dock wvous-tr-corner -int 4
defaults write com.apple.dock wvous-tr-modifier -int 0
echo "> Finder"
# Finder
# Set Finder sidebar width
defaults write com.apple.finder SidebarWidth 128
# Show Finder status bar
defaults write com.apple.finder ShowStatusBar -bool true
# Show finder path bar
defaults write com.apple.finder ShowPathbar -bool true
# Use list view in all Finder windows by default
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# When performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# Enable spring loading for directories
defaults write NSGlobalDomain com.apple.springing.enabled -bool true
# Reduce the spring loading delay for directories
defaults write NSGlobalDomain com.apple.springing.delay -float 0.25
# Show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Set Downloads as the default location for new Finder windows
defaults write com.apple.finder NewWindowTarget -string "PfDe"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Downloads/"
# 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
# Automatically open a new Finder window when a volume is mounted
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
# Disable the warning before emptying the Trash
defaults write com.apple.finder WarnOnEmptyTrash -bool false
# Show the $HOME/Library folder
sudo chflags nohidden "$HOME/Library"
# Show the /Volumes folder
sudo chflags nohidden "/Volumes"
# Expand useful info panels by default
defaults write com.apple.finder FXInfoPanesExpanded -dict \
General -bool true \
MetaData -bool true \
OpenWith -bool true \
Preview -bool true \
Privileges -bool true
echo "> Spotlight"
# Spotlight
# Disable Spotlight indexing for any volume that gets mounted
sudo defaults write "/Library/Preferences/com.apple.SpotlightServer.plist" ExternalVolumesIgnore -bool True
echo "> Terminal"
# Terminal
# Only use UTF-8 in Terminal.app
defaults write com.apple.terminal StringEncodings -array 4
# Set Terminal theme
osascript <<EOD
tell application "Terminal"
local windowAll
local windowInitial
local windowID
set themeName to "ToyChest"
set scriptDir to "./storage/"
(* Store the IDs of all the open terminal windows. *)
set windowInitial to id of every window
(* Open the custom theme so that it gets added to the list
of available terminal themes (note: this will open two
additional terminal windows). *)
do shell script "open '" & scriptDir & themeName & ".terminal'"
(* Wait a little bit to ensure that the custom theme is added. *)
delay 1
(* Set the custom theme as the default terminal theme. *)
set default settings to settings set themeName
(* Get the IDs of all the currently opened terminal windows. *)
set windowAll to id of every window
repeat with windowID in windowAll
(* Close the additional windows that were opened in order
to add the custom theme to the list of terminal themes. *)
if windowInitial does not contain windowID then
close (every window whose id is windowID)
(* Change the theme for the initial opened terminal windows
to remove the need to close them in order for the custom
theme to be applied. *)
else
set current settings of tabs of (every window whose id is windowID) to settings set themeName
end if
end repeat
end tell
EOD
echo "> Mail"
# Mail
# Display most recent message at the top
defaults write com.apple.mail ConversationViewSortDescending -bool true
# Disable inline attachments (just show the icons)
defaults write com.apple.mail DisableInlineAttachmentViewing -bool true
# Copy email addresses as foo@example.com instead of Foo Bar <foo@example.com> in Mail.app
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
echo "> TextEdit"
# TextEdit
# Use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -bool false
# 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
echo "> App Store"
# App Store
# Enable the automatic update check
defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true
# Check for software updates daily
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
# Download newly available updates in background
defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1
# Install System data files & security updates
defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1
# Turn on app auto-update
defaults write com.apple.commerce AutoUpdate -bool true
# Allow the App Store to reboot machine on macOS updates
defaults write com.apple.commerce AutoUpdateRestartRequired -bool true
echo "> Photos"
# Photos
# Prevent Photos from opening automatically when devices are plugged in
defaults write com.apple.ImageCapture disableHotPlug -bool true
echo "> Calendar"
# Calendar
# Show week numbers
defaults write com.apple.iCal "Show Week Numbers" -bool true
# Make text smaller
defaults write com.apple.iCal CalUICanvasOccurrenceFontSize -int 10
divider
echo "✅ MacOS complete – restart for changes to take effect"