-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
executable file
·280 lines (212 loc) · 8.03 KB
/
setup.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
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
#!/bin/bash
set -e
# To run:
# $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/jessie-ross/dot-files/main/setup.sh)"
# 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'
### Homebrew and Cask Apps ###
if ! which brew > /dev/null
then
echo "Homebrew is required:"
echo "https://brew.sh/"
exit 1
fi
# Install via app store as much as possible:
# brew install --cask --quiet \
# 1password \
# alfred \
# dash \
# docker \
# firefox \
# flux \
# slack \
# texts \
# textual \
# zoom
# Install dropbox for alfred + dash preferences
brew install --quiet \
clojure/tools/clojure \
coreutils \
findutils \
fzf \
gh \
gnu-tar \
gnu-sed \
gawk \
grep \
git \
ripgrep \
rsync \
lua-language-server \
neovim \
nvm \
parallel \
poetry \
pyenv \
python@3.10 \
python@3.11 \
python@3.12 \
pipx \
rustup \
swi-prolog \
tree-sitter \
universal-ctags \
volta \
weechat
# NPM
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
volta install --quiet \
node \
npm \
yarn
volta run npm install --quiet -g \
typescript \
typescript-language-server \
diagnostic-languageserver \
eslint_d \
pyright
# Java as recommended by Clojure:
# brew install --cask temurin@21
# Rust
rustup-init -y
### Apple Settings ###
# Disable “Press and Hold Keys”:
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# faster key repetition: https://twitter.com/rauchg/status/863451302348468225
defaults write NSGlobalDomain KeyRepeat -int 2
defaults write NSGlobalDomain InitialKeyRepeat -int 15
# System Preferences > Mission Control > Automatically rearrange Spaces based on most recent use
defaults write com.apple.dock mru-spaces -bool false
# Remap CapsLock to Ctrl
if [ ! -f ~/Library/LaunchAgents/me.scjr.CapslockToCtrl.plist ]
then
mkdir -p ~/Library/LaunchAgents
cat <<EOF > ~/Library/LaunchAgents/me.scjr.CapslockToCtrl.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>me.scjr.CapslockToCtrl</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/hidutil</string>
<string>property</string>
<string>--set</string>
<string>{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x7000000E0}]}</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOF
launchctl load me.scjr.CapslockBackspace.plist
fi
# Enable firewall
sudo /usr/libexec/ApplicationFirewall/socketfilterfw \
--setglobalstate on \
--setstealthmode on
# 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
# Save screenshots to the screenshots folder
mkdir -p ~/Screenshots
defaults write com.apple.screencapture location -string "${HOME}/Screenshots"
# Show remaining battery time; hide percentage
defaults write com.apple.menuextra.battery ShowPercent -string "NO"
defaults write com.apple.menuextra.battery ShowTime -string "YES"
# Disable app reopen after restart
defaults write -g ApplePersistence -bool no
# Disable asking for dictation
defaults write com.apple.HIToolbox AppleDictationAutoEnable -int 0
echo
echo '######################################################'
echo To wipe the Dock clean:
echo '$ defaults write com.apple.dock persistent-apps -array'
echo '######################################################'
echo
#### Activity Monitor ####
# Show the main window when launching Activity Monitor
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
# Visualize CPU usage in the Activity Monitor Dock icon
defaults write com.apple.ActivityMonitor IconType -int 5
# 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
#### Finder ####
# Finder: disable window animations and Get Info animations
defaults write com.apple.finder DisableAllAnimations -bool true
# Finder > Preferences > Show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Finder > View > Show Path Bar
defaults write com.apple.finder ShowPathbar -bool true
# Finder > Preferences > Show warning before changing an extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Show the ~/Library folder
chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library 2> /dev/null || true
# Display full POSIX path as Finder window title
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
# Keep folders on top when sorting by name
defaults write com.apple.finder _FXSortFoldersFirst -bool true
# 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
# Enable text selection in quick view
defaults write com.apple.finder QLEnableTextSelection -bool TRUE
#### Safari ####
# Add a context menu item for showing the Web Inspector in web views
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
# # Enable the Develop menu and the Web Inspector in Safari
# sudo defaults write com.apple.Safari IncludeDevelopMenu -bool true
# sudo defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
# sudo defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true
# # Enable Safari’s debug menu
# sudo defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
# # Press Tab to highlight each item on a web page
# sudo defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true
# sudo defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true
# # Make Safari’s search banners default to Contains instead of Starts With
# sudo defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
# # Show the full URL in the address bar (note: this still hides the scheme)
# sudo defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true
#### Mac App Store ####
# Enable the WebKit Developer Tools in the Mac App Store
defaults write com.apple.appstore WebKitDeveloperExtras -bool true
# Enable Debug Menu in the Mac App Store
defaults write com.apple.appstore ShowDebugMenu -bool true
# Enable the automatic update check
defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true
# Check for software updates daily, not just once per week
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
# Automatically download apps purchased on other Macs
defaults write com.apple.SoftwareUpdate ConfigDataInstall -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
### Add dotfiles in ###
mkdir -p ~/code-personal
if [ ! -d ~/code-personal/dot-files ] ; then
(
cd ~/code-personal
git clone https://github.com/jessie-ross/dot-files.git
cd dot-files
git remote set-url origin git@github.com:jessie-ross/dot-files.git
)
fi
(
cd ~/code-personal/dot-files
./links.sh
)
echo Some of these changes require a reboot to take effect.