Last active
February 7, 2026 03:32
-
-
Save goldcaddy77/e758f3fa836f36521f8c96aedfc2cec1 to your computer and use it in GitHub Desktop.
All-in-one Mac setup script for private dotfiles repo
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
| #!/bin/bash | |
| # Minimal Mac Setup Bootstrap | |
| # This script is synced to: https://gist.github.com/goldcaddy77/e758f3fa836f36521f8c96aedfc2cec1 | |
| set -e | |
| DOTFILES_REPO="goldcaddy77/dotfiles" | |
| DOTFILES_PATH="$HOME/code/goldcaddy77/dotfiles" | |
| echo "π¦ Mac Setup Bootstrap" | |
| # 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)" | |
| [[ -f /opt/homebrew/bin/brew ]] && eval "$(/opt/homebrew/bin/brew shellenv)" | |
| else | |
| echo "β Homebrew already installed" | |
| fi | |
| # Install GitHub CLI | |
| if ! command -v gh &> /dev/null; then | |
| echo "β Installing GitHub CLI..." | |
| brew install gh | |
| else | |
| echo "β GitHub CLI already installed" | |
| fi | |
| # Authenticate with GitHub (sets up SSH keys) | |
| if ! gh auth status &> /dev/null; then | |
| echo "β Authenticating with GitHub (will set up SSH)..." | |
| gh auth login --web --git-protocol ssh | |
| else | |
| echo "β GitHub authenticated" | |
| fi | |
| # Clone or update dotfiles (gh uses SSH after auth above) | |
| if [[ -d "$DOTFILES_PATH/.git" ]]; then | |
| echo "β Updating dotfiles..." | |
| cd "$DOTFILES_PATH" | |
| # Switch to SSH if currently using HTTPS | |
| CURRENT_URL=$(git remote get-url origin) | |
| if [[ "$CURRENT_URL" == https://* ]]; then | |
| echo "β Switching remote from HTTPS to SSH..." | |
| git remote set-url origin "git@github.com:$DOTFILES_REPO.git" | |
| fi | |
| git pull && cd - >/dev/null | |
| else | |
| echo "β Cloning dotfiles..." | |
| mkdir -p ~/code/goldcaddy77 | |
| gh repo clone "$DOTFILES_REPO" "$DOTFILES_PATH" | |
| fi | |
| # Run full setup from dotfiles | |
| echo "" | |
| echo "β Running setup from dotfiles..." | |
| bash "$DOTFILES_PATH/setup_mac.sh" |
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
| #!/bin/bash | |
| # Minimal Mac Setup Bootstrap | |
| # Installs prerequisites and runs setup from dotfiles repo | |
| set -e | |
| DOTFILES_REPO="goldcaddy77/dotfiles" | |
| DOTFILES_PATH="$HOME/code/goldcaddy77/dotfiles" | |
| echo "π¦ Mac Setup Bootstrap" | |
| # Install Homebrew | |
| if ! command -v brew &> /dev/null; then | |
| echo "β Installing Homebrew..." | |
| NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL | |
| https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
| [[ -f /opt/homebrew/bin/brew ]] && eval "$(/opt/homebrew/bin/brew shellenv)" | |
| else | |
| echo "β Homebrew already installed" | |
| fi | |
| # Install GitHub CLI | |
| if ! command -v gh &> /dev/null; then | |
| echo "β Installing GitHub CLI..." | |
| brew install gh | |
| else | |
| echo "β GitHub CLI already installed" | |
| fi | |
| # Authenticate with GitHub | |
| if ! gh auth status &> /dev/null; then | |
| echo "β Authenticating with GitHub..." | |
| gh auth login --web | |
| else | |
| echo "β GitHub authenticated" | |
| fi | |
| # Clone or update dotfiles | |
| if [[ -d "$DOTFILES_PATH/.git" ]]; then | |
| echo "β Updating dotfiles..." | |
| cd "$DOTFILES_PATH" && git pull origin main && cd - >/dev/null | |
| else | |
| echo "β Cloning dotfiles..." | |
| mkdir -p ~/code/goldcaddy77 | |
| gh repo clone "$DOTFILES_REPO" "$DOTFILES_PATH" | |
| fi | |
| # Run full setup from dotfiles | |
| echo "" | |
| echo "β Running setup from dotfiles..." | |
| bash "$DOTFILES_PATH/setup_mac.sh" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment