-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mac-set-up.sh
41 lines (35 loc) · 1.37 KB
/
mac-set-up.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
#!/bin/bash
# Install Command Line Tools for Xcode
if ! xcode-select --print-path &>/dev/null; then
echo "Installing Xcode Command Line Tools..."
xcode-select --install &>/dev/null
until xcode-select --print-path &>/dev/null; do
sleep 5
done
echo "Xcode Command Line Tools installed"
fi
# Install Homebrew
if ! command -v brew &>/dev/null; then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/$(whoami)/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
echo "Homebrew installed"
fi
# Install NVM
if [ ! -d "$HOME/.nvm" ]; then
echo "Installing NVM..."
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
echo "NVM installed"
fi
# Immediately source the NVM scripts
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Install Node
nvm install node # Install latest version
nvm use node
echo "Node and NPM installed"