Last active
October 28, 2024 16:10
-
-
Save swayanshu-apbr/a4425c78c2ce183329ffe33ebf728a42 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Ensure the script is running in the user's root directory | |
cd ~ || exit | |
# Print description of what the script will do | |
echo "================================================================" | |
echo "Development Setup Gauntlet: Automating the installation of tools" | |
echo "This script will perform the following steps:" | |
echo " 1. Install Homebrew" | |
echo " 2. Install Ruby 3.1.2, chruby, and ruby-install" | |
echo " 3. Install OpenJDK@17" | |
echo " 4. Install NVM and Node.js 20.9.0" | |
echo " 5. Install Yarn" | |
echo " 6. Install CocoaPods" | |
echo " 7. Install Fastlane 2.225.0" | |
echo " 8. Install Xcode" | |
echo " 9. Add paths to .zshrc" | |
echo "10. Display installed versions and show added paths" | |
echo "================================================================" | |
# Function to display progress | |
progress_bar() { | |
local DURATION=${1} | |
echo -n "In progress" | |
for ((i = 0 ; i < DURATION ; i++)); do | |
echo -n "." | |
sleep 1 | |
done | |
echo "" | |
} | |
# Step 1: Install Homebrew | |
echo "Step 1: Installing Homebrew..." | |
if ! command -v brew >/dev/null 2>&1; then | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && | |
echo "Homebrew installed successfully!" && | |
echo >> ~/.zprofile && | |
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile && | |
eval "$(/opt/homebrew/bin/brew shellenv)" | |
else | |
echo "Homebrew is already installed." | |
fi | |
progress_bar 5 | |
# Step 2: Install Ruby 3.1.2, chruby, and ruby-install | |
echo "Step 2: Installing Ruby 3.1.2, chruby, and ruby-install..." | |
brew install chruby ruby-install && | |
ruby-install ruby 3.1.2 && | |
# Add Ruby path to zshrc | |
echo "source /opt/homebrew/opt/chruby/share/chruby/chruby.sh" >> ~/.zshrc | |
echo "source /opt/homebrew/opt/chruby/share/chruby/auto.sh" >> ~/.zshrc | |
echo "chruby ruby-3.1.2" >> ~/.zshrc && | |
echo "Ruby 3.1.2 installed successfully!" | |
progress_bar 5 | |
# Step 3: Install OpenJDK@17 | |
echo "Step 3: Installing OpenJDK@17..." | |
brew install openjdk@17 && | |
# Add OpenJDK path to zshrc | |
echo 'export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"' >> ~/.zshrc && | |
echo "OpenJDK@17 installed successfully!" | |
progress_bar 5 | |
# Step 4: Install NVM and Node 20.9.0 | |
echo "Step 4: Installing NVM and Node 20.9.0..." | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash && | |
source ~/.zshrc && | |
nvm install 20.9.0 && | |
nvm alias default 20.9.0 && | |
# Add NVM path to zshrc | |
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.zshrc | |
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> ~/.zshrc && | |
echo "NVM and Node 20.9.0 installed successfully!" && | |
source ~/.zshrc | |
progress_bar 5 | |
# Step 5: Install Yarn 1.22.19 | |
echo "Step 5: Installing Yarn ..." | |
brew install yarn && | |
echo "Yarn 1.22.19 installed successfully!" | |
progress_bar 5 | |
# Step 6: Install CocoaPods 1.4.2 | |
echo "Step 6: Installing CocoaPods ..." | |
sudo gem install cocoapods && | |
echo "CocoaPods installed successfully!" | |
progress_bar 5 | |
# Step 7: Install Fastlane 2.225.0 | |
echo "Step 7: Installing Fastlane 2.225.0..." | |
sudo gem install fastlane -v 2.225.0 && | |
echo "Fastlane 2.225.0 installed successfully!" | |
progress_bar 5 | |
# Step 8: Install Xcode | |
echo "Step 8: Installing Xcode..." | |
brew install mas && | |
mas install 497799835 && # Mac App Store ID for Xcode | |
# Set Xcode path | |
sudo xcode-select --switch /Applications/Xcode.app && | |
sudo xcodebuild -license accept && | |
echo "Xcode installed successfully!" | |
progress_bar 10 | |
# Final Step: Display installed versions and zshrc updates | |
echo "================================================================" | |
echo "Final Step: Displaying installed versions and showing zshrc updates" | |
echo "Lines added to ~/.zshrc:" | |
tail -n 10 ~/.zshrc | |
echo "Installed Versions:" | |
which ruby | |
node -v | |
java --version | |
gem which cocoapods | |
gem which fastlane | |
xcodebuild -version | |
source ~/.zshrc | |
echo "================================================================" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment