-
Notifications
You must be signed in to change notification settings - Fork 16
/
deps_part1.sh
executable file
·116 lines (97 loc) · 3.02 KB
/
deps_part1.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
#!/bin/zsh
# Script to install dependencies for a developer on Apple Silicon M1.
# Pre-requisites: Git, Zsh (Mac uses zsh by default)
# Note: that all dependencies installed through homebrew by default will be done through Rosetta 2 since M1 doesnt't have native support for all formulas.
# Note: Homebrew in rosetta is installed in /usr/local/bin. When M1 support arrives it will be installed in /opt
# Node v15 works on Mac M1 for now.
# Author: Hemant Joshi
# TODO: Add deps_part1 to PATH so that it can be called without zsh
source ~/.zshrc
bold=$(tput bold)
check_install_result() {
if [ $? -eq 0 ]; then
printf "\n${bold}$1 installed successfully\n"
fi
sleep 5
}
printf "${bold}\n--------------------- Welcome to dev setup Part I ---------------------\n\n"
printf "${bold}This includes setting up of homebrew and installing basic dependencies...\n"
arch -x86_64 /usr/local/bin/brew -v >> /dev/null
if [ $? -eq 0 ]; then
printf "${bold}\nHomebrew is already installed under Rosetta..\n"
else
printf "${bold}\nHomebrew is not installed... Installing homebrew under Rosetta for now...\n"
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
echo 'alias ibrew="arch -x86_64 /usr/local/bin/brew"' >> ~/.zshrc
source ~/.zshrc
ibrew --help
check_install_result "ibrew"
fi
/opt/homebrew/bin/brew -v >> /dev/null
if [ $? -eq 0 ]; then
printf "${bold}\nM1 Homebrew already Installed\n"
else
printf "${bold}\nInstalling M1 Homebrew\n..."
sudo mkdir -p /opt/homebrew
sudo chown -R $(whoami):staff /opt/homebrew
cd /opt
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
echo 'export PATH=/opt/homebrew/bin:/usr/local/bin:$PATH' >> ~/.zshrc
fi
source ~/.zshrc
commands_install=(
zsh-syntax-highlighting
go
android-platform-tools
htop
openjdk
redis
pyenv
postgresql
sqlc
php
mysql
)
printf "\n"
for j in $commands_install
do
printf "${bold}Installing $j\n"
brew list $j > /dev/null
if [ $? -eq 0 ]; then
printf "$j already installed successfully\n\n"
else
brew install $j
check_install_result "$j"
fi
done
java --version
if [ $? -eq 0 ]; then
printf "\n${bold} Java setup successfull"
else
`sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk`
fi
# Installing heroku-cli
printf "\n${bold} Heroku CLI\n"
brew list heroku > /dev/null
if [ $? -eq 0 ]; then
printf "heroku installed successfully\n"
else
brew tap heroku/brew > /dev/null
brew install heroku
check_install_result "heroku"
fi
zsh node_deps.sh
yarn --version
if [ $? -eq 0 ]; then
printf "${bold}\nYarn installed successfully\n"
else
printf "${bold}\nYarn not installed\n"
fi
echo 'export PATH=$(pyenv root)/shims:$PATH' >> ~/.zshrc
zsh py_deps.sh
python --version
if [ $? -eq 0 ]; then
printf "${bold}\nPython Installed...\n"
else
printf "${bold}\nReinstall python\n"
fi