This repository has been archived by the owner on Jan 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
system-setup-mac
executable file
·166 lines (133 loc) · 3.89 KB
/
system-setup-mac
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
#!/bin/bash
<<DETAILS
Set up a new macOS system with my preferred packages.
Usage: ./system-setup
DETAILS
echo -e "Starting macOS system setup...\n"
##############
# Programming
##############
brew update
brew upgrade
# Allow brew to install packages to /usr/local/
sudo chown -R $(whoami) $(brew --prefix)/*
# Wakatime
echo -e "\n\nWakaTime coding metrics:\n"
python3 -m pip install --user wakatime
if [ ! -f ~/.wakatime.cfg ]; then
echo -e "\n\nWakaTime config file setup:\n"
read -p "Enter WakaTime API Key: " key
echo -e """[settings]
debug = false
hidefilenames = false
ignore =
COMMIT_EDITMSG$
PULLREQ_EDITMSG$
MERGE_MSG$
TAG_EDITMSG$
api_key=$key
""" > ~/.wakatime.cfg
fi
# Node.js
echo -e "\n\nNode.js LTS:\n"
curl --fail -LSs https://install-node.now.sh/lts | sudo bash
npm config set prefix '~/.local'
# TypeScript
echo -e "\n\nTypeScript:\n"
npm i -g typescript ts-node @types/node
npm i -g lodash @types/lodash
## ts-node speedup using swc - Rust based transpiler
## https://typestrong.org/ts-node/docs/transpilers/#bundled-swc-integration
npm i -g @swc/core @swc/helpers regenerator-runtime
# JDK 8, 11 and Apache Maven
echo -e "\n\nJava and Maven:\n"
brew install openjdk@8
brew install openjdk@11
brew install maven
# openjdk@8 and @11 are keg-only; we need to create symbolic links so that the macOS java wrapper can find it
sudo ln -sfn $(brew --prefix)/opt/openjdk@8/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-8.jdk
sudo ln -sfn $(brew --prefix)/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
# LaTeX
read -rep $'\n\nLaTeX [y/n]: ' opt_latex
if [ "$opt_latex" == 'y' ]; then
echo -e "\nInstalling..."
brew install --cask mactex
brew install pandoc
brew install latexindent
else
echo -e "Skipping...\n"
fi
##########
# Neovim
##########
echo -e "\n\nNeovim:\n"
brew install neovim
echo -e "\n\nPython3 provider for nvim:\n"
python3 -m pip install --user --upgrade pynvim
# linting/formatting
echo -e "\n\nALE linters/fixers:\n"
## python
python3 -m pip install --user isort
python3 -m pip install --user autopep8
python3 -m pip install --user flake8
## html, css, js, md, etc.
npm i -g prettier @prettier/plugin-xml
## shell
brew install shellcheck
## java
java_format="google-java-format-1.11.0-all-deps.jar"
brew install wget
wget https://github.com/google/google-java-format/releases/download/v1.11.0/"$java_format" -O ~/.local/lib/"$java_format"
# HTML live server
echo -e "\n\nHTML live server:\n"
npm i -g live-server
###############
# Misc./System
###############
# tmux
echo -e "\n\ntmux:\n"
brew install tmux
# fzf fuzzy finder
echo -e "\n\nFuzzy finder fzf:\n"
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
# Rigrep
echo -e "\n\nRipgrep (rg):\n"
brew install ripgrep
# Minimap
echo -e "\n\nMinimap:\n"
brew install code-minimap
# Watchman
read -rep $'\n\nWatchman [y/n]: ' opt_watchman
if [ "$opt_watchman" == 'y' ]; then
echo -e "\nInstalling..."
brew install watchman
else
echo -e "Skipping...\n"
fi
# zsh
echo -e "\n\noh-my-zsh:\n(Note: \"exit\" from oh-my-zsh to resume setup)\n"
# oh my zsh will start a sub-shell, just "exit" and the this setup script will continue
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc
brew tap homebrew/command-not-found
# trash-cli (safer alternative to rm -rf)
echo -e "\n\nTrash CLI:\n"
brew install trash-cli
# tl;dr (man, but with examples)
echo -e "\n\nTLDR:\n"
brew install tldr
# https://github.com/chubin/cheat.sh
echo -e "\n\nCheat sheat:\n"
curl https://cht.sh/:cht.sh > ~/.local/bin/cht.sh
chmod +x ~/.local/bin/cht.sh
# bat (a cat clone, with syntax highlighting)
echo -e "\n\nBat:\n"
brew install bat
# dpkg
echo -e "\n\ndpkg:\n"
brew install dpkg
# git-pull-all
echo -e "\n\ngit-pull-all:\n"
npm i -g git-pull-all
echo -e "\nSystem setup complete!\n"