-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev_env_mac.sh
More file actions
68 lines (59 loc) · 1.98 KB
/
Copy pathdev_env_mac.sh
File metadata and controls
68 lines (59 loc) · 1.98 KB
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
#!/bin/bash
### This script is for a Mac environment ###
# Check if Xcode tools are already installed
if ! command -v xcode-select &>/dev/null; then
echo "Installing Xcode tools..."
xcode-select --install
else
echo "Xcode tools are already installed."
fi
# Check if Homebrew is already installed
if ! command -v brew &>/dev/null; then
echo "Installing Homebrew..."
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
else
echo "Homebrew is already installed."
fi
# Setup git if not configured
if [[ -z $(git config --global user.name) ]]; then
read -p "Enter the Name for the GitHub account: " git_name
git config --global user.name "$git_name"
fi
if [[ -z $(git config --global user.email) ]]; then
read -p "Enter the email address for the GitHub account: " git_email
git config --global user.email "$git_email"
ssh-keygen -t ed25519 -C "$git_email"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
echo "Public key:"
cat ~/.ssh/id_ed25519.pub | pbcopy
echo "Public key copied to clipboard."
fi
# Check if nvm is already installed
if ! command -v nvm &>/dev/null; then
echo "Installing nvm..."
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.nvm/nvm.sh
else
echo "nvm is already installed."
fi
# Check if Node.js is already installed
if ! command -v node &>/dev/null; then
echo "Installing Node.js..."
nvm install node --lts
nvm use node --lts
else
echo "Node.js is already installed."
fi
# Install required packages using Homebrew
echo "Installing packages via Homebrew..."
brew_packages=("python@3.9" "openjdk" "cakebrew" "gcc" "g++" "make" "cmake" "gdb" "valgrind" "clang-format" "clang-tidy" "clang")
for package in "${brew_packages[@]}"; do
if ! brew list "$package" &>/dev/null; then
echo "Installing $package..."
sudo brew install "$package"
else
echo "$package is already installed."
fi
done
echo "Setup complete!"