Skip to content

Instantly share code, notes, and snippets.

@minuz
Last active February 9, 2026 00:27
Show Gist options
  • Select an option

  • Save minuz/a73ab3be3a082448e15c673ceb4bb48b to your computer and use it in GitHub Desktop.

Select an option

Save minuz/a73ab3be3a082448e15c673ceb4bb48b to your computer and use it in GitHub Desktop.
Basic setup for development on mac
#!/usr/bin/env zsh
set -e
# Helper function to check if a Homebrew package is installed
is_brew_installed() {
brew list "$1" >/dev/null 2>&1
}
echo "==> Checking Xcode Command Line Tools"
xcode-select -p >/dev/null 2>&1 || xcode-select --install
echo "==> Handling Homebrew"
if ! command -v brew >/dev/null 2>&1; then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
# Skip 'brew upgrade' entirely to save time.
# Only update the package list if it's older than 24 hours.
echo "Homebrew detected. Skipping global upgrade for speed."
fi
# Fix the specific error you saw: Remove the deprecated/broken tap
if brew tap | grep -q "homebrew/cask-versions"; then
echo "Removing deprecated homebrew/cask-versions tap..."
brew untap homebrew/cask-versions || true
fi
echo "==> Handling Ruby"
if is_brew_installed "ruby"; then
echo "Ruby is already installed. Skipping."
else
brew install ruby
fi
echo "==> Handling NVM"
if [ ! -d "$HOME/.nvm" ]; then
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/HEAD/install.sh | bash
fi
# Load NVM without polluting shell output
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
echo "==> Handling Node 22"
# Only install if not already the active version
if [[ "$(node -v 2>/dev/null)" != v22* ]]; then
nvm install 22
nvm alias default 22
nvm use default
else
echo "Node 22 already active."
fi
## Enable Corepack and prepare Yarn 1.22.22
echo "==> Enabling Corepack"
corepack enable
# Prepare Yarn 1.22.22 and set it as the active version
# The Azure Pipelines has issues with Yarn berry so we
# haven't migrated to it yet. This ensures we have the
# correct version of Yarn available.
corepack prepare [email protected] --activate
echo "✅ macOS dev environment ready"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment