-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup_laptop
executable file
·146 lines (125 loc) · 3.44 KB
/
setup_laptop
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
#!/usr/bin/env bash
#######################################################################
# Basic setup for a new Mac #
#######################################################################
trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT
set -e
fancy_echo() {
echo "$1"
}
# Accept the Terms of Service from this
xcode-select --install
if [ ! -r ~/.bash_profile ]; then
echo -e 'if [ -r ~/.bashrc ]; then
source ~/.bashrc
fi' >> ~/.bash_profile
fi
if ! command -v brew >/dev/null; then
fancy_echo "Installing Homebrew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo -e '\nexport PATH="/usr/local/bin:$PATH"' >> ~/.bashrc
export PATH="/usr/local/bin:$PATH"
fi
fancy_echo "Installing all the Homebrew things..."
brew update --force # https://github.com/Homebrew/brew/issues/1151
brew bundle --file=- <<EOF
brew "git"
brew "postgresql"
brew "redis"
brew "neovim"
brew "fzf"
brew "ripgrep"
brew "diff-so-fancy"
brew "watchman"
brew "openssl"
brew "coreutils"
brew "automake"
brew "autoconf"
brew "libyaml"
brew "readline"
brew "libxslt"
brew "libtool"
brew "unixodbc"
brew "python3"
brew "yarn"
brew "fish"
brew "starship"
brew "wxmac"
brew "tldr"
EOF
read -p "Set up Postgres? (Y/n) " -n 1 -r
echo # move to a new line after prompt
if [[ $REPLY =~ ^[Yy]$ ]]
then
fancy_echo "Setting up Postgres..."
brew services start postgresql
rm -rf /usr/local/var/postgres
initdb /usr/local/var/postgres -E utf8
createuser -s postgres
fi
fancy_echo "Starting Redis..."
brew services start redis
if [ ! -d "$HOME/.asdf" ]; then
fancy_echo "Installing asdf, Language version manager..."
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.0
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bash_profile
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile
source ~/.bashrc # .bashrc sources .bash_profile, see above
fi
read -p "Install Elixir? (Y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
fancy_echo "Installing Erlang..."
asdf plugin-add erlang || true
export KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac"
asdf install erlang 21.0
asdf global erlang 21.0
fancy_echo "Installing Elixir..."
asdf plugin-add elixir || true
asdf install elixir 1.9.1
asdf global elixir 1.9.1
fi
read -p "Install Node.js? (Y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
fancy_echo "Installing node.js..."
asdf plugin-add nodejs || true
NODEJS_CHECK_SIGNATURES=no asdf install nodejs 10.16.3
asdf global nodejs 10.16.3
fancy_echo "Installing global node packages..."
npm -g i stylelint ember-cli prettier tslint eslint typescript
fi
read -p "Install Ruby? (Y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
fancy_echo "Installing Ruby..."
asdf plugin-add ruby || true
asdf install ruby 2.6.4
asdf global ruby 2.6.4
fi
read -p "Install Rust? (Y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
fancy_echo "Installing Rust..."
curl https://sh.rustup.rs -sSf | sh
fi
read -p "Install AWS-CLI? (Y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
fancy_echo "Installing pip3 packages..."
pip3 install awscli
fi
read -p "Install Vim? (Y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
fancy_echo "Installing vundle..."
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
pip3 install neovim
fi
fancy_echo "Done!"