Skip to content

Instantly share code, notes, and snippets.

@dkbrummitt
Last active November 6, 2025 13:52
Show Gist options
  • Select an option

  • Save dkbrummitt/09afe3508fe827a0e750da8ed71ba8bc to your computer and use it in GitHub Desktop.

Select an option

Save dkbrummitt/09afe3508fe827a0e750da8ed71ba8bc to your computer and use it in GitHub Desktop.
video-dev-onboarding
#!/bin/bash
#
# ---
# Mac Setup Script
#
# This script bootstraps a new Mac for development, installing common tools
# and applications via Homebrew and other package managers.
#
# Sections:
# 1. System (Homebrew, Zsh)
# 2. Languages (Go, Node, Python, Java)
# 3. SCM (Git, GitHub)
# 4. Cloud and DevOps (AWS, GCP, K8s, Docker, Terraform)
# 5. Other Utilities (CLI tools, helpers)
# 6. IDEs
# 7. Browsers
# 8. Productivity
# 9. Multimedia
# 10. Final Config
# ---
# Exit immediately if a command exits with a non-zero status.
set -e
# ---
# 1. System
# ---
echo "Starting system setup..."
# 1a. Install Xcode Command Line Tools
# This might pop a GUI. It's often best to run this *before* the script.
echo "Checking for Xcode Command Line Tools..."
if ! xcode-select -p &>/dev/null; then
echo "Installing Xcode Command Line Tools. Please follow the GUI prompts."
xcode-select --install
# Wait for the user to complete the installation
echo "Press any key when Xcode tools are finished installing..."
read -n 1
else
echo "Xcode Command Line Tools already installed."
fi
# 1b. 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)"
# Add Homebrew to PATH (for Apple Silicon)
# The installer should provide this instruction, but we do it just in case.
if [ -f "/opt/homebrew/bin/brew" ]; then
echo "Adding Homebrew to PATH for Apple Silicon..."
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
else
echo "Homebrew is already installed."
fi
# 1c. Update and check Homebrew
echo "Updating Homebrew..."
brew update
brew doctor
# ---
# 2. Languages
# ---
echo "Installing programming languages and runtimes..."
brew install node go python jenv
# 2a. Node.js (via Brew)
# Install npm packages
echo "Installing global npm packages..."
npm install -g typescript
# 2b. Python (via pyenv)
echo "Installing pyenv and default Python..."
brew install pyenv
if ! grep -q 'pyenv init' ~/.zprofile; then
echo "Adding pyenv config to ~/.zprofile..."
echo -e '\n# pyenv config' >> ~/.zprofile
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zprofile
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zprofile
echo 'eval "$(pyenv init -)"' >> ~/.zprofile
fi
# Source the profile to make pyenv available in this script
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
# Install a default Python version
# Find and use the latest stable 3.x version available to pyenv.
echo "Finding latest stable Python 3 version..."
# This command filters pyenv's list for stable x.y.z versions,
# filters for 3.x, sorts by version, and gets the last one.
DEFAULT_PYTHON=$(pyenv install --list | grep -E "^\s*[0-9]+\.[0-9]+\.[0-9]+$" | grep -E "^\s*3\." | sort -V | tail -n 1 | tr -d ' ')
if [ -z "$DEFAULT_PYTHON" ]; then
echo "Could not find a stable Python 3 version. Defaulting to 3.12.0."
DEFAULT_PYTHON="3.12.0"
fi
echo "Installing Python $DEFAULT_PYTHON (this may take a while)..."
if ! pyenv versions --bare | grep -q "$DEFAULT_PYTHON"; then
pyenv install $DEFAULT_PYTHON
fi
pyenv global $DEFAULT_PYTHON
pyenv rehash
# Install pipreqs using the pyenv-managed pip
echo "Installing Python AI/ML libraries..."
pip install pipreqs jupyterlab google-cloud-aiplatform google-genai certifi
# ---
# 3. SCM
# ---
echo "Installing SCM tools..."
brew install git
brew install hub
brew install gh
# ---
# 4. Cloud and DevOps
# ---
echo "Installing Cloud & DevOps tools..."
# `aws-shell` is deprecated (features in awscli v2)
# `aws-mon` is no longer in Homebrew
brew install awscli kubernetes-cli ollama terraform localstack terragrunt gimme-aws-creds
brew install warrensbox/tap/tfswitch
brew install docker-compose
brew install gemini-cli
brew install --cask docker google-cloud-sdk
# ---
# 5. Other Utilities
# ---
echo "Installing other utilities..."
# `sonarqube` installs the *server*. `sonar-scanner` is the client.
brew install sonar-scanner
brew install dos2unix watch openssl wget htop gnupg jq pandoc restish hugo openapi-generator newman yj google-benchmark
brew install --cask postman
# ---
# 6. CLI Productivity Enhancements
# ---
echo "Installing CLI power-user tools..."
# fzf (fuzzy finder), ripgrep (fast grep), bat (cat replacement), eza (ls replacement)
brew install fzf ripgrep bat eza
# Install fzf keybindings (Ctrl+R, Ctrl+T)
echo "Setting up fzf keybindings..."
"$(brew --prefix)/opt/fzf/install" --all
# ---
# 7. IDEs
# ---
echo "Installing IDEs..."
brew install --cask visual-studio-code
brew install --cask cursor
# ---
# 8. Browsers
# ---
echo "Installing browsers..."
brew install --cask google-chrome firefox brave-browser opera
# ---
# 9. Productivity
# ---
echo "Installing productivity tools..."
brew install watchman gist
brew install --cask slack keybase iterm2 zoom
brew install --cask wireshark
# ---
# 10. Environment & Window Management
# ---
echo "Installing env and window tools..."
brew install direnv
brew install --cask rectangle
if ! grep -q 'direnv hook' ~/.zprofile; then
echo "Adding direnv hook to ~/.zprofile..."
echo -e '\n# direnv hook' >> ~/.zprole
echo 'eval "$(direnv hook zsh)"' >> ~/.zprofile
fi
# ---
# 11. Multimedia
# ---
echo "Installing multimedia tools..."
# `brew options` is deprecated. Installing default formulae.
# `libav` is redundant with ffmpeg.
# `youtube-dl` is less maintained; `yt-dlp` is the modern standard.
brew install ffmpeg ffmpegthumbnailer handbrake media-info
brew install imagemagick
brew install yt-dlp
brew install --cask obs vlc
# ---
# 12. Final Config
# ---
echo "Cleaning up Homebrew..."
brew cleanup
echo -e "\n---"
echo "✅ Mac setup script finished!"
echo "---"
echo "\nNext steps:"
echo "1. Restart your terminal (or run 'source ~/.zprofile') to load new paths."
echo "2. Run 'gcloud init' to configure the Google Cloud SDK."
echo "3. Run 'gcloud auth application-default login' to set up Python auth."
echo "4. Configure any newly installed apps (Slack, Docker, etc.)."
echo "5. Run 'pyenv global $DEFAULT_PYTHON' to ensure the default Python is set."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment