-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup_mac.sh
executable file
·104 lines (87 loc) · 2.28 KB
/
setup_mac.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
#!/usr/bin/env bash
CUR_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OH_MY_ZSH_DIR="$HOME/.oh-my-zsh"
## xcode tests
xcode-select -p >/dev/null
if [ $? -ne 0 ]; then
echo "Need to install xcode command line tools"
echo "Run 'xcode-select --install'"
exit 1
else
echo "xcode already installed"
fi
mkdir -p ${HOME}/configs
# Setup brew if not installed
which brew >/dev/null
if [ $? -ne 0 ]; then
echo "Installing homebrew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
echo "Homebrew already installed"
fi
if [[ ! -d '/usr/local/opt/openssl/' ]]; then
echo 'Install openssl'
brew install openssl
fi
if [[ ! -d '/usr/local/opt/curl' ]]; then
echo 'Installing curl'
brew install curl --with-libssh2 --with-nghttp2 --with-openssl
fi
# Install required brew packages for setup
which git | grep local >/dev/null
if [ $? -ne 0 ]; then
brew install git --with-curl --with-openssl
fi
which zsh >/dev/null
if [ $? -ne 0 ]; then
brew install zsh --with-pcre
fi
which htop >/dev/null
if [ $? -ne 0 ]; then
brew install htop --with-ncurses
fi
which python3 >/dev/null
if [ $? -ne 0 ]; then
brew install python
fi
which python2 >/dev/null
if [ $? -ne 0 ]; then
brew install python2
fi
which cmake >/dev/null
if [ $? -ne 0 ]; then
brew install cmake
fi
CARGO_ENV="$HOME/.cargo/env"
if [[ -f "$CARGO_ENV" ]]; then
source "$CARGO_ENV"
fi
which cargo >/dev/null
if [ $? -ne 0 ]; then
brew install rustup
rustup-init
source "$CARGO_ENV"
fi
which exa >/dev/null
if [ $? -ne 0 ]; then
RUSTFLAGS="-C target-cpu=native -C link-args=-s" cargo install exa --features git
fi
which rg >/dev/null
if [ $? -ne 0 ]; then
RUSTFLAGS="-C target-cpu=native -C link-args=-s" cargo install ripgrep --features simd-accel,avx-accel
fi
which fd >/dev/null
if [ $? -ne 0 ]; then
RUSTFLAGS="-C target-cpu=native -C link-args=-s" cargo install fd-find
fi
which exa >/dev/null
if [ $? -ne 0 ]; then
RUSTFLAGS="-C target-cpu=native -C link-args=-s" cargo install exa
fi
# Setup pip
pip3 install --upgrade pip setuptools wheel
pip2 install --upgrade pip setuptools wheel
"$CUR_DIR"/setup_links.sh
"$CUR_DIR"/setup_virts.sh
"$CUR_DIR"/update.sh
brew bundle install --file="$CUR_DIR/Brewfile"