Skip to content

Instantly share code, notes, and snippets.

@minuz
Created January 17, 2025 21:56
Show Gist options
  • Save minuz/a73ab3be3a082448e15c673ceb4bb48b to your computer and use it in GitHub Desktop.
Save minuz/a73ab3be3a082448e15c673ceb4bb48b to your computer and use it in GitHub Desktop.
Basic setup for development on mac
#!/bin/sh
printf "# Step 1 : Installing Xcode Command Line Tools"
xcode-select --install
echo "# Step 2 : Installing/Updating Homebrew"
# Check for Homebrew and install if not found
if test ! $(which brew); then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo "Updating Homebrew..."
brew update && brew upgrade
fi
echo "# Step 3 : Installing OpenSSL"
openssl=$(openssl version | grep -Eo '[0-9]\.[0-9]\.[a-zA-Z0-9]+')
echo "${openssl}"
if [[ $openssl == 2.* ]]; then
brew install openssl
echo $(export PATH="/opt/homebrew/opt/openssl@3/bin:${PATH}") >>~/.zshrc
else
echo "# OpenSSL already installed..."
fi
echo "# Step 4 : Installing Ruby (Not the system default)"
ruby=$(ruby -v | grep -Eo '[0-9]\.[0-9]\.[a-zA-Z0-9]+')
if [[ $ruby == 2.* ]]; then
brew install ruby
else
echo "# Ruby already installed..."
fi
# Install Node.js and npm using nvm if nvm is not already installed
echo "# Step 5 : Installing NVM"
if test ! $(which nvm) && [ ! -d "$HOME/.nvm" ]; then
echo "Installing nvm..."
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
fi
# Load NVM into the current shell session
source ~/.nvm/nvm.sh
# Install or upgrade Node.js using NVM
echo "# Step 5 : Installing node 16"
nvm install 22
nvm alias default 22/*
nvm use default
# Installing rimraf globally
echo "# Step 6 : Installing some utils"
if test ! $(which rimraf); then
echo "Installing rimraf..."
npm i -g rimraf
else
echo "rimraf already installed."
fi
# Install Yarn package manager
if test ! $(which yarn); then
echo "Installing Yarn..."
npm i -g yarn
echo "Using yarn $(yarn --version)"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment