This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
/
mac-setup.sh
executable file
·72 lines (63 loc) · 1.74 KB
/
mac-setup.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
#!/bin/bash
set -e
install_homebrew() {
# If homebrew is already installed, don't do it again.
if ! brew --help >/dev/null 2>&1; then
echo "Installing Homebrew"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
echo "Updating Homebrew"
brew update > /dev/null
# Make the cellar.
mkdir -p /usr/local/Cellar
}
install_node() {
if ! brew ls node >/dev/null 2>&1; then
echo "Installing node"
brew install node 2>&1
fi
}
install_mongodb() {
if ! brew ls mongodb >/dev/null 2>&1; then
echo "Installing mongodb"
brew install mongodb 2>&1
fi
}
install_phantomjs() {
if brew ls phantomjs >/dev/null 2>&1; then
# If phantomjs is already installed via brew, check if it is outdated
if brew outdated | grep -q -e 'phantomjs'; then
# If phantomjs is outdated, update it
echo "Upgrading phantomjs"
brew upgrade phantomjs 2>&1
fi
else
# Otherwise, install via brew
echo "Installing phantomjs"
brew install phantomjs 2>&1
fi
}
install_redis() {
if ! brew ls redis >/dev/null 2>&1; then
echo "Installing redis"
brew install redis 2>&1
fi
}
install_chromedriver() {
if brew ls chromedriver >/dev/null 2>&1; then
if brew outdated | grep -q -e 'chromedriver'; then
# If chromedriver is outdated, update it
echo "Upgrading chromedriver"
brew upgrade chromedriver 2>&1
fi
else
# Otherwise, install via brew
echo "Installing chromedriver"
brew install chromedriver 2>&1
fi
}
install_homebrew
install_node
install_mongodb
install_redis
install_phantomjs