-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacos.sh
executable file
·119 lines (83 loc) · 4.39 KB
/
macos.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
#!/usr/bin/env bash
# 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
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Disable the sound effects on boot
sudo nvram SystemAudioVolume=" "
# Ask for a password asap
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
# Do not show icons for hard drives, servers, and removable media on the desktop
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool false
defaults write com.apple.finder ShowMountedServersOnDesktop -bool false
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool false
# Finder: show status bar
defaults write com.apple.finder ShowStatusBar -bool true
# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Finder: allow text selection in Quick Look
defaults write com.apple.finder QLEnableTextSelection -bool true
# New Finder Window shows your home folder
defaults write com.apple.finder NewWindowTarget PfHm
# Show all filename extensions.
defaults write -g AppleShowAllExtensions -bool true
# Avoid creating .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# Set the icon size of Dock items to 40 pixels
defaults write com.apple.dock tilesize -int 40
# Automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true
# Remove all Dock items
defaults delete com.apple.dock recent-apps
defaults delete com.apple.dock persistent-others
# Make Dock icons of hidden applications translucent
defaults write com.apple.dock showhidden -bool true
# Bottom right screen corner → Start screen saver
defaults write com.apple.dock wvous-br-corner -int 5
defaults write com.apple.dock wvous-br-modifier -int 0
# Automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# Save to disk instead of iCloud
defaults write -g NSDocumentSaveNewDocumentsToCloud -bool false
# Increase sound quality for Bluetooth headphones/headsets
# defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
# Prevent Safari from opening ‘safe’ files automatically after downloading
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
# Enable the Develop menu and the Web Inspector in Safari
defaults write com.apple.Safari ShowDevelopMenu -bool true
# Add a context menu item for showing the Web Inspector in web views
defaults write -g WebKitDeveloperExtras -bool true
# Show the main window when launching Activity Monitor
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
# Enable press and hold
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool true
# Set a blazingly fast keyboard repeat rate (for backspace mostly)
defaults write NSGlobalDomain KeyRepeat -int 1
defaults write NSGlobalDomain InitialKeyRepeat -int 10
# Only use UTF-8 in Terminal.app
defaults write com.apple.terminal StringEncodings -array 4
# Show all processes in Activity Monitor
defaults write com.apple.ActivityMonitor ShowCategory -int 0
# Sort Activity Monitor results by CPU usage
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
defaults write com.apple.ActivityMonitor SortDirection -int 0
# 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
# Stop Photos from opening automatically
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
# Disable press and hold in VScode
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
# defaults delete -g ApplePressAndHoldEnabled
# Disable local Time Machine backups
hash tmutil &> /dev/null && sudo tmutil disablelocal
for app in "Dock" "Finder" "Safari"; do
killall "${app}" > /dev/null 2>&1
done
echo "Done setting macOS defaults. Note that some of these changes may require a logout/restart to take effect."