-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-mac.sh
78 lines (60 loc) · 1.85 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
#!/bin/bash
# Hide "last login" line when starting a new terminal session
echo 'Hide last Login'
echo '-----------------'
touch $HOME/.hushlogin
install_rosetta() {
sudo softwareupdate --install-rosetta
}
install_brew() {
if ! command -v "brew" &> /dev/null; then
printf "Homebrew not found, installing."
# install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# set path
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
printf "Installing homebrew packages..."
brew update
# Upgrade any already installed formulae
brew upgrade
brew bundle
brew doctor
}
create_dirs() {
declare -a dirs=(
"$HOME/screenshots"
"$HOME/.dotfiles"
"$HOME/repos"
)
for i in "${dirs[@]}"; do
mkdir "$i"
done
}
build_xcode() {
if ! xcode-select --print-path &> /dev/null; then
xcode-select --install &> /dev/null
until xcode-select --print-path &> /dev/null; do
sleep 5
done
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license
fi
}
## NVM / NPM Config
mkdir $HOME/.nvm
echo 'export NVM_DIR=$HOME/.nvm' >>! $HOME/.zshrc
echo '[ -s "$(brew --prefix nvm)/nvm.sh" ] && . "$(brew --prefix nvm)/nvm.sh"' >>! $HOME/.zshrc # This loads nvm
echo '[ -s "$(brew --prefix nvm)/etc/bash_completion.d/nvm" ] && . "$(brew --prefix nvm)/etc/bash_completion.d/nvm"' >>! $HOME/.zshrc # This loads nvm bash_completion
## Pyen config
echo 'eval "$(pyenv init --path)"' >> ~/.zshrc
printf "🌈 Installing Rosetta\n"
install_rosetta
printf "🗄 Creating directories\n"
create_dirs
printf "🛠 Installing Xcode Command Line Tools\n"
build_xcode
printf "🍺 Installing Homebrew packages\n"
install_brew
source .macos
printf "✨ Done!\n"