Last active
February 9, 2025 14:43
-
-
Save millipz/33614ef6f90fa971fec0663bf2a5c4c8 to your computer and use it in GitHub Desktop.
This file contains 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 | |
set -euo pipefail | |
trap 'echo "β Error on line ${LINENO}. Exiting." >&2' ERR | |
echo "π Starting Bootstrap Setup..." | |
# 1. Check & Install Xcode Command Line Tools | |
echo "π Checking for Xcode Command Line Tools..." | |
if ! xcode-select -p &>/dev/null; then | |
echo "β οΈ Xcode Command Line Tools not found. Initiating installation..." | |
xcode-select --install || { echo "β Failed to initiate Xcode Command Line Tools installation."; exit 1; } | |
echo "β³ Waiting for Xcode Command Line Tools to install (please confirm the installation prompt)..." | |
until xcode-select -p &>/dev/null; do | |
sleep 5 | |
done | |
echo "β Xcode Command Line Tools installation complete!" | |
else | |
echo "β Xcode Command Line Tools are already installed." | |
fi | |
# 2. Check & Install Homebrew | |
echo "π Checking for Homebrew..." | |
if ! command -v brew &>/dev/null; then | |
echo "β οΈ Homebrew not found. Installing Homebrew..." | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" || { echo "β Failed to install Homebrew."; exit 1; } | |
echo "β Homebrew installed successfully!" | |
else | |
echo "β Homebrew is already installed." | |
fi | |
# 3. Check & Install chezmoi | |
echo "π Checking for chezmoi..." | |
if ! command -v chezmoi &>/dev/null; then | |
echo "β οΈ chezmoi not found. Installing chezmoi via Homebrew..." | |
brew install chezmoi || { echo "β Failed to install chezmoi via Homebrew."; exit 1; } | |
echo "β chezmoi installed successfully!" | |
else | |
echo "β chezmoi is already installed." | |
fi | |
# 4. Set Dotfiles Repository URL (public, so no credentials are required) | |
# Replace the URL below with your public dotfiles repository. | |
DOTFILES_REPO="https://github.com/millipz/chezmoi.git" | |
echo "π Using dotfiles repository: $DOTFILES_REPO" | |
# 5. Initialize and Apply Dotfiles via chezmoi | |
echo "π Initializing and applying dotfiles with chezmoi..." | |
chezmoi init --apply "$DOTFILES_REPO" || { echo "β Failed to initialize and apply dotfiles."; exit 1; } | |
echo "β Dotfiles applied successfully!" | |
echo "π Bootstrap setup complete! Enjoy your freshly configured machine!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment