Last active
August 15, 2026 14:33
-
-
Save helgi/1913361d1828e821228f47612cb333e7 to your computer and use it in GitHub Desktop.
Dotfiles bootstrap script
This file contains hidden or 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
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| echo "Bootstrapping dotfiles..." | |
| DOTFILES_DIR="$HOME/dotfiles" | |
| 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)" | |
| fi | |
| if [ -x /opt/homebrew/bin/brew ]; then | |
| eval "$(/opt/homebrew/bin/brew shellenv)" | |
| fi | |
| if ! command -v git &>/dev/null || ! command -v gh &>/dev/null; then | |
| echo "Installing git and gh via Homebrew..." | |
| HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_ENV_HINTS=1 brew install --yes git gh | |
| fi | |
| if ! gh auth status &>/dev/null; then | |
| echo "Authenticating GitHub CLI (visit https://github.com/login/device and enter the code below):" | |
| gh auth login --hostname github.com --git-protocol https --web </dev/null | |
| fi | |
| if [ ! -d "$DOTFILES_DIR" ]; then | |
| echo "Cloning helgi/dotfiles into $DOTFILES_DIR..." | |
| gh repo clone helgi/dotfiles "$DOTFILES_DIR" | |
| else | |
| echo "Dotfiles repo already exists at $DOTFILES_DIR. Pulling latest updates..." | |
| git -C "$DOTFILES_DIR" pull --ff-only | |
| fi | |
| echo "Handing off to install.sh..." | |
| exec "$DOTFILES_DIR/install.sh" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment