-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmacos.sh
executable file
·150 lines (114 loc) · 3.95 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
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
# If you want to set other settings, see: https://macos-defaults.com.
# also see: https://github.com/mathiasbynens/dotfiles/blob/main/.macos.
printf "\033[33m%s\033[m\n" "Setting macOS preferences"
# 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
#
# General UI/UX
#
# Disable sound effects on boot
sudo nvram StartupMute=%01
#
# Trackpad
#
# Enable tap click
defaults write com.apple.AppleMultitouchTrackpad "Clicking" -bool "false"
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad "Clicking" -bool "false"
defaults -currentHost write -g com.apple.mouse.tapBehavior -bool "false"
#
# Keyboard
#
# Repeating speed
defaults write -g InitialKeyRepeat -int 15
defaults write -g KeyRepeat -int 2
#
# Dock
#
# Icon size (default: 48)
defaults write com.apple.dock "tilesize" -int "36"
# Autohide (default: false)
defaults write com.apple.dock "autohide" -bool "true"
# Autohide animation duration (default: 0.5)
defaults write com.apple.dock "autohide-time-modifier" -float "0.1"
# Autohide delay (default: 0.5)
defaults write com.apple.dock "autohide-delay" -float "0.1"
# Shows recents (default: true)
defaults write com.apple.dock "show-recents" -bool "false"
#
# Screenshot
#
# Disable shadow to window capture (default: true)
defaults write com.apple.screencapture "disable-shadow" -bool "true"
# Save location (default: ~/Desktop)
defaults write com.apple.screencapture "location" -string "~/Desktop"
#
# Finder
#
# Shows extensions (default: false)
defaults write NSGlobalDomain "AppleShowAllExtensions" -bool "true"
# Shows hidden files a.k.a. dotfiles (default: false)
defaults write com.apple.Finder "AppleShowAllFiles" -bool "true"
#
# Menu bar
#
# Datetime formatting (default: "M\u6708d\u65e5(EEE) H:mm" -> e.g. "4月10日(土) 13:26")
defaults write com.apple.menuextra.clock "DateFormat" -string "\"M/d(EEE) H:mm\""
#
# Mission control
#
# Rearranges automatically (default: true)
defaults write com.apple.dock "mru-spaces" -bool "false"
#
# Safari
#
# Shows Developer in Menu bar
defaults write com.apple.Safari "IncludeDevelopMenu" -bool "true"
defaults write com.apple.Safari "WebKitDeveloperExtrasEnabledPreferenceKey" -bool "true"
defaults write com.apple.Safari "WebKitPreferences.developerExtrasEnabled" -bool "true"
#
# Spotlight
#
# Index order and items to search
defaults write com.apple.spotlight orderedItems -array \
'{"enabled" = 0; "name" = "APPLICATIONS";}' \
'{"enabled" = 0; "name" = "SYSTEM_PREFS";}' \
'{"enabled" = 0; "name" = "DIRECTORIES";}' \
'{"enabled" = 0; "name" = "PDF";}' \
'{"enabled" = 0; "name" = "FONTS";}' \
'{"enabled" = 0; "name" = "DOCUMENTS";}' \
'{"enabled" = 0; "name" = "MESSAGES";}' \
'{"enabled" = 0; "name" = "CONTACT";}' \
'{"enabled" = 0; "name" = "EVENT_TODO";}' \
'{"enabled" = 0; "name" = "IMAGES";}' \
'{"enabled" = 0; "name" = "BOOKMARKS";}' \
'{"enabled" = 0; "name" = "MUSIC";}' \
'{"enabled" = 0; "name" = "MOVIES";}' \
'{"enabled" = 0; "name" = "PRESENTATIONS";}' \
'{"enabled" = 0; "name" = "SPREADSHEETS";}' \
'{"enabled" = 0; "name" = "SOURCE";}' \
'{"enabled" = 0; "name" = "MENU_DEFINITION";}' \
'{"enabled" = 0; "name" = "MENU_OTHER";}' \
'{"enabled" = 0; "name" = "MENU_CONVERSION";}' \
'{"enabled" = 0; "name" = "MENU_EXPRESSION";}' \
'{"enabled" = 0; "name" = "MENU_WEBSEARCH";}' \
'{"enabled" = 0; "name" = "MENU_SPOTLIGHT_SUGGESTIONS";}'
# Load new settings before rebuilding the index
killall mds > /dev/null 2>&1
# Make sure indexing is enabled for the main volume
sudo mdutil -i on / > /dev/null
# Rebuild the index from scratch
sudo mdutil -E / > /dev/null
#
# Alfred
#
# Setting sync folder
defaults write com.runningwithcrayons.Alfred-Preferences "syncfolder" -string "~/dotfiles"
#
# Termination
#
# Apply changes
killall Dock
killall Finder