-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacos
481 lines (424 loc) · 12.4 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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
#!/usr/bin/env bash
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until the script has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
install_thoughtbot() {
log_folder="$HOME/installer/logs"
mkdir -p $log_folder && cd "$HOME/installer"
# Don't check if this file exists, download it each time
curl https://raw.githubusercontent.com/thoughtbot/laptop/master/mac > mac
sh mac 2>&1 | tee $log_folder/thoughtbot.log
# Install basic dotfiles
if [ -d "$HOME/.dotfiles" ]; then
cd "$HOME/.dotfiles"
git pull
cd "$HOME/.dotfiles-local"
git pull
else
git clone git://github.com/thoughtbot/dotfiles.git "$HOME/.dotfiles"
git clone https://github.com/execat/dotfiles-local.git "$HOME/.dotfiles-local"
fi
env RCRC=$HOME/.dotfiles/rcrc rcup
rcup
# Install 3 finger drag
defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerDrag -bool true
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerDrag -bool true
# Disable hot corners
defaults write com.apple.dock wvous-tr-corner -int 0
defaults write com.apple.dock wvous-tl-corner -int 0
}
install_brew() {
# Install Java for aircrack and other software
# brew cask install java
brew cask install java
brew bundle --file=- <<EOF
# Shell
brew "bash"
brew "bash-completion2"
brew "binutils"
brew "cowsay"
brew "exa"
brew "fasd"
brew "findutils"
brew "fortune"
brew "fzf"
brew "moreutils"
brew "tree"
brew "zsh-autosuggestions"
# GNU utilities
brew "gawk"
brew "gcc"
brew "gnu-indent"
brew "gnu-sed"
brew "gnu-tar"
# brew "gnupg"
brew "grep"
# Git addons
brew "bfg"
brew "git-extras"
brew "git-flow"
brew "git-lfs"
brew "fossil"
# Languages
brew "chezscheme"
brew "coq"
brew "crystal"
brew "elixir"
brew "elm"
brew "erlang"
brew "go"
brew "guile"
brew "leiningen"
brew "lua"
brew "nvm"
brew "mit-scheme"
brew "python"
brew "rust"
brew "s-lang"
brew "sbt"
# Haskell packages
brew "ghc"
brew "cabal-install"
brew "stack"
# Web
brew "lynx"
# Servers
brew "darkhttpd"
cask "homebrew/cask-versions/adoptopenjdk8"
brew "elasticsearch"
# brew "kubernetes-cli" # Docker installs this
tap "mongodb/brew"
brew "mongodb-community"
brew "mysql"
# Text editors
# brew "emacs"
brew "neovim"
# Rust utilities # https://www.wezm.net/technical/2019/10/useful-command-line-tools/
brew "bat"
brew "dust"
brew "exa"
brew "hexyl"
brew "mdcat"
brew "tig"
# Utilities
brew "buku"
brew "cloc"
brew "dark-mode"
brew "highlight"
brew "howdoi"
brew "httpie"
brew "jq"
brew "fdupes"
brew "mackup"
brew "mas"
brew "midnight-commander"
brew "mycli"
brew "p7zip"
brew "pandoc"
brew "pigz"
brew "pgcli"
brew "pv"
brew "rename"
brew "ripgrep"
brew "speedtest-cli"
brew "ssh-copy-id"
# brew "sylpheed"
brew "thefuck"
brew "tldr"
brew "wget"
brew "youtube-dl"
# Media
brew "ffmpeg"
brew "lame"
# Security
brew "aircrack-ng"
brew "binwalk"
brew "cifer"
brew "fcrackzip"
brew "foremost"
brew "mitmproxy"
brew "hydra"
brew "john"
brew "openssh"
brew "tcpflow"
brew "tcpreplay"
brew "tcptrace"
brew "socat"
brew "sqlmap"
EOF
}
install_brew_cask() {
brew bundle --file=- <<EOF
# Brew cask formulae
# Academics
cask "manuscripts"
cask "praat"
# Markdown_editors
cask "macdown"
# cask "mou" # Not available for 10.12+
cask "typora"
# Book
cask "calibre"
# cask "ichm"
cask "pdf-expert"
cask "sigil"
cask "skim"
# Utils
cask "alacritty"
cask "amethyst"
cask "arduino"
cask "charles"
cask "docker"
cask "dash"
# cask "deeper"
cask "diffmerge"
cask "dropbox"
cask "expressions"
cask "flux"
cask "iterm2"
cask "jdiskreport"
cask "kap"
cask "karabiner-elements"
cask "keepingyouawake"
cask "keka"
cask "launchrocket"
cask "meetingbar"
cask "meld"
cask "menumeters"
cask "numi"
cask "nvalt"
cask "selfcontrol"
cask "smcfancontrol"
cask "tomighty"
cask "suspicious-package"
cask "tunnelblick"
cask "vienna"
# cask "zazu" # Alfred ;-(
# Music
cask "clementine"
cask "neteasemusic"
cask "transmission"
cask "xiami"
# Database
cask "dbeaver-community"
cask "sequel-pro"
cask "db-browser-for-sqlite"
# Communication
cask "flume"
cask "keybase"
# cask "mstdn"
cask "noti"
cask "nordvpn"
cask "skype"
cask "teamviewer"
cask "thunderbird"
cask "telegram"
cask "wechat"
# Browsers
cask "firefox"
cask "google-chrome"
cask "firefox-developer-edition"
cask "tor-browser"
cask "beaker-browser"
# Media
cask "darktable"
cask "iina"
# cask "xquartz" # Needed for Inkscape
# cask "inkscape"
cask "kodi"
cask "handbrake"
cask "helium"
cask "mpv"
cask "rawtherapee"
# cask "soundflower" # Failing
cask "tuxguitar"
cask "vlc"
# Games
cask "0-ad"
cask "openemu"
cask "openttd"
# cask "playonmac"
# Programming
# cask "affinic-debugger"
cask "kitematic"
cask "virtualbox"
cask "virtualbox-extension-pack"
# Languages
cask "racket"
# IDE
cask "android-studio"
cask "atom"
cask "intellij-idea-ce"
cask "hex-fiend"
cask "r"
cask "rstudio"
cask "sublime-text"
# RestClient
cask "cocoarestclient"
cask "insomnia"
cask "postman"
# Install emacs for Spacemacs
tap "d12frosted/emacs-plus"
brew "emacs-plus"
tap "homebrew/cask-fonts"
# Brew cask fonts
# Fonts
cask "font-inconsolata-dz-for-powerline"
cask "font-inconsolata-for-powerline"
cask "font-inconsolata-g-for-powerline"
cask "font-menlo-for-powerline"
cask "font-meslo-for-powerline"
cask "font-noto-mono-for-powerline"
EOF
}
install_binaries() {
# Check their GitHub: https://github.com/thisredone/rb
curl https://raw.githubusercontent.com/thisredone/rb/master/rb -o ~/.bin/rb && chmod a+x ~/.bin/rb
# WeChat plugin
cd ~/Downloads &&
rm -rf WeChatTweak-macOS &&
git clone https://github.com/Sunnyyoung/WeChatTweak-macOS --depth=1 &&
cd WeChatTweak-macOS &&
sudo make install
# Ammonite REPL for Scala
sh -c '(echo "#!/usr/bin/env sh" && curl -L https://github.com/lihaoyi/Ammonite/releases/download/1.2.1/2.12-1.2.1) > ~/.bin/amm && chmod a+x ~/.bin/amm'
# Expo and related NPM packages
# npm install expo-cli --global
}
run_script() {
# End script before killing all applications
curl https://raw.githubusercontent.com/mathiasbynens/dotfiles/master/.macos | \
sed -e 's/# Kill affected applications/exit/g' | \
sed -e 's/AppleLanguages -array "en" "nl"/AppleLanguages -array "en" "cn" "mr"/g' | \
sed -e 's/AppleLocale -string "en_GB@currency=EUR"/AppleLocale -string "en_US@currency=USD"/g' | \
sed -e 's/Europe\/Brussels/Asia\/Singapore/g' | \
grep -v 'com.apple.notificationcenterui.plist' | \
grep -v 'Solarized Dark xterm-256color' | \
grep -v 'com.apple.dock wvous' | \
grep -v 'open "${HOME}/init/Solarized Dark.itermcolors' | \
grep -v 'com.irradiatedsoftware.SizeUp' | \
grep -v 'Spectacle' | \
grep -v 'com.twitter' | \
grep -v 'com.tapbots.TweetbotMac' | \
bash
cat <<EOF
# Set computer name (as done via System Preferences → Sharing)
sudo scutil --set ComputerName "beluga"
sudo scutil --set HostName "beluga"
sudo scutil --set LocalHostName "beluga"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "beluga"
# Wipe all (default) app icons from the Dock
# defaults write com.apple.dock persistent-apps -array
EOF
}
# Install ohmyzsh
install_ohmyzsh() {
if [ -d "$HOME/.oh-my-zsh" ]; then
cd "$HOME/.oh-my-zsh"
git pull
else
# Do entire oh-my-zsh installation but don't drop in the Zsh session (last line of the script)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | grep -v 'env zsh')"
git clone https://github.com/MichaelAquilina/zsh-you-should-use.git $HOME/.oh-my-zsh/custom/plugins/you-should-use
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/wulfgarpro/history-sync.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/history-sync
echo "Now customizing zsh setup"
# Change theme (remove '' if not on macOS)
# sed -i "s/robbyrussell/af-magic/g" ~/.zshrc
sed -i '' "s/robbyrussell/af-magic/g" ~/.zshrc
cat >> ~/.zshrc <<EOF
# Local config
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local
# aliases
[[ -f ~/.aliases ]] && source ~/.aliases
export PATH="$HOME/.bin:$PATH"
EOF
fi
# Change permissions so that zsh does not complain
chmod g-w,o-w /usr/local/share
# Use .dotfiles and .dotfiles-local to create aliases
rcup -d .dotfiles -d .dotfiles-local
# `locate` command initialization
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
}
# Install SpaceVim for neovim
install_spacevim() {
if [ -d "$HOME/.SpaceVim" ]; then
cd "$HOME/.SpaceVim"
git pull
else
curl -sLf https://spacevim.org/install.sh | bash -s -- --install neovim
pip3 install neovim
nvim
if [ -d "$HOME/.SpaceVim.d" ]; then
echo "~/.SpaceVim.d is created"
else
echo "~/.SpaceVim.d folder not found"
fi
fi
}
install_emacs() {
if [ -d "$HOME/.emacs.d" ]; then
echo "If this is from your previous emacs installation, delete this file and rerun this method"
cd "$HOME/.emacs.d"
git pull
else
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
if [ -d "$HOME/.emacs.d" ]; then
echo "~/.emacs.d is created"
else
echo "~/.emacs.d folder not found"
fi
fi
}
show_final_messages() {
cat << END
Go to Trackpad and set these options:
* Look up & data detectors -> tap with 3 fingers
* Secondary click -> Click or tap with 2 fingers
* Tap to click -> Tap with one finger
Also move click to "light" and turn on silent clicking.
Also do these things manually:
1. Activate unlimited scrollback for iTerm, set to 'reuse previous dir', change font to Inconsolata-dz Pt 14, in Profile -> Terminal -> Silence bell
2. Go to Finder -> Cmd + up arrow 2 times -> Drag your home folder to left sidebar
3. Click on battery on top right and click on "Show Percentage", click on input method -> open keyboard preferences -> set caps lock to change input method
4. Login to your Firefox account and start bookmark/addon sync
5. Login to your accounts in Netease Music Player/Xiami
6. Put Flux on autostart
7. Login to Dropbox, Skype, Telegram
8. Make VLC default player for famous formats
9. Copy over important VPN configs for Tunnelblick and database configs for Sequel Pro
10. Set up Kodi as per the reddit thread
11. Set up .ssh keys (copy or create new)
12. You might want to log in to these websites:
Google account | Twitter | Amazon | GitHub | GitLab | reddit
13. Start jdiskreport and run mlocate
14. Set up keyboards for your preferred languages and layouts
15. Put sensible defaults for Menumeters
* Display CPU Menu Meter -> Percentage, Display percentage as: User and System
* Disk -> No
* Memory -> Used/Free Totals
* Network -> Arrows and Throughput
16. Install Xcode from App Store and execute these two commands:
* sudo xcode-select -s /Applications/Xcode.app
* sudo xcodebuild -license
And run Xcode (you might have to install additional components)
17. Run Android Studio so that it can download shizzle for you (~1GB of stuff but takes a while)
18. Execute 'defaults write com.apple.dock persistent-apps -array' to remove all the dock items (if installing for the first time)
19. Disable notifications on Firefox: about:config > dom.webnotifications.enabled > set to false
20. sudo spctl --master-disable to allow all installations from packages, install wireless: https://community.tp-link.com/en/home/stories/detail/1642
21. Iterm preferences -> Keys -> Keybindings -> Change Ctrl + Tab and Ctrl + Shift + Tab to "Next tab" and "Previous tab"
Finally, close this tab and all the previously opened terminal tabs and continue working in a new tab.
END
}
install_thoughtbot
install_brew
install_brew_cask
install_binaries
run_script
install_ohmyzsh
install_spacevim
install_emacs
show_final_messages