This repository has been archived by the owner on Mar 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mac
executable file
·63 lines (50 loc) · 1.79 KB
/
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
#!/bin/bash
# The Metanorma macOS Setup script
fancy_echo() {
# shellcheck disable=SC2039
local fmt="$1"; shift
# shellcheck disable=SC2059
printf "\n$fmt\n" "$@"
}
append_to_file() {
# shellcheck disable=SC2039
local file="$1"
# shellcheck disable=SC2039
local text="$2"
if [ "$file" = "$HOME/.bash_profile" ]; then
file="$HOME/.bash_profile"
fi
if ! grep -qs "^$text$" "$file"; then
printf "\n%s\n" "$text" >> "$file"
fi
}
if ! command -v brew >/dev/null; then
fancy_echo "Installing Homebrew ..."
curl -fsS \
'https://raw.githubusercontent.com/Homebrew/install/master/install' | ruby
# shellcheck disable=SC2016
append_to_file "$shell_file" 'export PATH="/usr/local/bin:$PATH"'
else
fancy_echo "Homebrew already installed. Skipping ..."
fi
fancy_echo "Updating Homebrew..."
brew update
fancy_echo "Verifying the Homebrew installation..."
if brew doctor; then
fancy_echo "Your Homebrew installation is good to go."
else
fancy_echo "Your Homebrew installation reported some errors or warnings."
echo "If the warnings are related to Python, you can ignore them."
echo "Otherwise, review the Homebrew messages to see if any action is needed."
fi
fancy_echo "Installing metanorma formula from master ..."
brew install --HEAD 'https://raw.githubusercontent.com/metanorma/homebrew-metanorma/master/Formula/metanorma.rb'
fancy_echo "Installing formulas and casks from the Brewfile ..."
if brew bundle --file="$HOME/Brewfile"; then
fancy_echo "All formulas and casks were installed successfully."
else
fancy_echo "Some formulas or casks failed to install."
echo "This is usually due to one of the Mac apps being already installed,"
echo "in which case, you can ignore these errors."
fi
fancy_echo '[metanorma-setup] Completed -- please re-launch Terminal!'