/
install.sh
executable file
·76 lines (60 loc) · 1.82 KB
/
install.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
#!/bin/sh
fancy_echo() {
local fmt="$1"; shift
# shellcheck disable=SC2059
printf "\n$fmt\n" "$@"
}
append_to_zshrc() {
local text="$1" zshrc
local skip_new_line="${2:-0}"
if [ -w "$HOME/.zshrc.local" ]; then
zshrc="$HOME/.zshrc.local"
else
zshrc="$HOME/.zshrc"
fi
if ! grep -Fqs "$text" "$zshrc"; then
if [ "$skip_new_line" -eq 1 ]; then
printf "%s\n" "$text" >> "$zshrc"
else
printf "\n%s\n" "$text" >> "$zshrc"
fi
fi
}
fancy_echo "OHAI! Let's setup your mac, shall we?"
cat << "EOF"
) (
/( (\___/) )\ _____________
( #) \ (- -) ( # | '\\\\\\
||___c\ >'__| | ' ____|_
||**** )`_/ **' | + '||::::::
.__ |'* ___| |___*' | '||_____|
\_| |'*( ~ ,)' \'_______|_____|
)) |' /(. ' .)\ ___/____|___\___
(( _""";!___*_____\_| _ ' <<<:|
/ /| |_________'___o_o|
/_____/ /
|:____|/ "Boy, I love this stuff".
EOF
# Install Homebrew
fancy_echo "Installing Homebrew..."
if test ! $(which brew); then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# Install Rosetta for M1 Macs
if [[ $(uname -m) == 'arm64' ]]; then
sudo softwareupdate -install-rosetta --agree-to-license
fi
# Update recipes
brew update
# Install deps with bundle (listed in Brewfile)
brew tap homebrew/bundle
brew bundle
# Make ZSH the default shell environment
fancy_echo "Setting Zsh as default..."
chsh -s $(which zsh)
# Set macOS preferences, originally from https://github.com/mathiasbynens/dotfiles
# fancy_echo "Set macOS preferences ..."
# source .macos
# Install Oh-My-Zsh
fancy_echo "Installing Oh My Zsh..."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"