Skip to content

Instantly share code, notes, and snippets.

@leeovery
Last active January 7, 2026 14:55
Show Gist options
  • Select an option

  • Save leeovery/167d8e564abe1d9a7c01e5a57d194952 to your computer and use it in GitHub Desktop.

Select an option

Save leeovery/167d8e564abe1d9a7c01e5a57d194952 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
echo "πŸš€ Dotfiles Bootstrap"
echo "====================="
echo ""
# 1. Xcode CLI tools
if ! xcode-select -p &> /dev/null; then
echo "πŸ“¦ Installing Xcode Command Line Tools..."
xcode-select --install
echo ""
echo "⚠️ Xcode installation started in background."
echo " Once complete, open a NEW terminal and re-run this script."
echo ""
exit 0
fi
echo "βœ“ Xcode Command Line Tools"
# 2. 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)" </dev/tty
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
echo "βœ“ Homebrew"
# 3. Modern Bash (bash-toolkit requires 4+)
if [[ "${BASH_VERSINFO[0]}" -lt 4 ]]; then
echo "πŸ“¦ Installing Homebrew Bash..."
brew install bash
fi
echo "βœ“ Bash 5"
# 4. GitHub CLI
if ! command -v gh &> /dev/null; then
echo "πŸ“¦ Installing GitHub CLI..."
brew install gh
fi
echo "βœ“ GitHub CLI"
# 5. GitHub auth (required for private repo)
if ! gh auth status &> /dev/null 2>&1; then
echo ""
echo "πŸ” GitHub authentication required for private repos..."
echo ""
gh auth login </dev/tty
fi
echo "βœ“ GitHub authenticated"
# Export token for Homebrew (needed for private taps)
export HOMEBREW_GITHUB_API_TOKEN=$(gh auth token)
echo "βœ“ Homebrew GitHub token set"
# 6. Clone dotfiles
if [[ ! -d "$HOME/.dotfiles" ]]; then
echo ""
echo "πŸ“₯ Cloning dotfiles..."
gh repo clone leeovery/dotfiles "$HOME/.dotfiles"
fi
echo "βœ“ Dotfiles cloned"
# 7. Run setup
echo ""
echo "πŸš€ Starting dotfiles setup..."
cd "$HOME/.dotfiles"
/opt/homebrew/bin/bash ./bin/dotsetup install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment