Initial commit: Complete macOS dotfiles system
🖖 Features: - Master 'engage' script for one-command setup - 120+ CLI tools via Homebrew - 40+ Applications (casks + MAS apps) - Complete macOS system configuration - Security hardening and privacy settings - Obsidian knowledge vault setup - Comprehensive backup strategies - Automated symlink management Live long and prosper\! 🚀 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,333 @@
|
||||
#!/usr/bin/env bash
|
||||
# 🖖 ENGAGE - Complete macOS dotfiles installation
|
||||
# "Make it so!" - Captain Jean-Luc Picard
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Colors and symbols
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
MAGENTA='\033[0;35m'
|
||||
CYAN='\033[0;36m'
|
||||
BOLD='\033[1m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Star Trek ASCII art
|
||||
cat << 'EOF'
|
||||
______
|
||||
| ____|
|
||||
| |__ _ __ __ _ __ _ __ _ ___
|
||||
| __| | '_ \ / _` |/ _` |/ _` |/ _ \
|
||||
| |____| | | | (_| | (_| | (_| | __/
|
||||
|______|_| |_|\__, |\__,_|\__, |\___|
|
||||
__/ | __/ |
|
||||
|___/ |___/
|
||||
|
||||
🖖 "Engage!" - Complete macOS Setup
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
EOF
|
||||
|
||||
echo ""
|
||||
echo -e "${CYAN}${BOLD}Welcome to the Universal macOS Setup System${NC}"
|
||||
echo -e "${YELLOW}From zero to fully configured in minutes...${NC}"
|
||||
echo ""
|
||||
|
||||
# Check if we're on macOS
|
||||
if [[ "$OSTYPE" != "darwin"* ]]; then
|
||||
echo -e "${RED}❌ This script is designed for macOS only${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to check if command exists
|
||||
command_exists() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Function to ask yes/no with default
|
||||
ask() {
|
||||
local prompt="$1"
|
||||
local default="${2:-y}"
|
||||
local response
|
||||
|
||||
while true; do
|
||||
if [[ "$default" == "y" ]]; then
|
||||
read -p "$prompt (Y/n): " response
|
||||
response=${response:-y}
|
||||
else
|
||||
read -p "$prompt (y/N): " response
|
||||
response=${response:-n}
|
||||
fi
|
||||
|
||||
case "$response" in
|
||||
[Yy]*) return 0 ;;
|
||||
[Nn]*) return 1 ;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# Phase indicator
|
||||
phase() {
|
||||
echo ""
|
||||
echo -e "${MAGENTA}${BOLD}━━━ $1 ━━━${NC}"
|
||||
}
|
||||
|
||||
# Success indicator
|
||||
success() {
|
||||
echo -e "${GREEN}✅ $1${NC}"
|
||||
}
|
||||
|
||||
# Warning indicator
|
||||
warning() {
|
||||
echo -e "${YELLOW}⚠️ $1${NC}"
|
||||
}
|
||||
|
||||
# Error indicator
|
||||
error() {
|
||||
echo -e "${RED}❌ $1${NC}"
|
||||
}
|
||||
|
||||
# Progress indicator
|
||||
progress() {
|
||||
echo -e "${BLUE}🔄 $1${NC}"
|
||||
}
|
||||
|
||||
# =============================================================================
|
||||
# Pre-flight checks
|
||||
# =============================================================================
|
||||
|
||||
phase "Pre-flight Systems Check"
|
||||
|
||||
# Check for Command Line Tools
|
||||
if ! command_exists git; then
|
||||
progress "Installing Xcode Command Line Tools..."
|
||||
xcode-select --install
|
||||
echo "Please complete the Command Line Tools installation and run this script again."
|
||||
exit 1
|
||||
fi
|
||||
success "Command Line Tools installed"
|
||||
|
||||
# Check for Homebrew
|
||||
if ! command_exists brew; then
|
||||
progress "Installing Homebrew..."
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
|
||||
# Add Homebrew to PATH for this session
|
||||
if [[ -f /opt/homebrew/bin/brew ]]; then
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
elif [[ -f /usr/local/bin/brew ]]; then
|
||||
eval "$(/usr/local/bin/brew shellenv)"
|
||||
fi
|
||||
fi
|
||||
success "Homebrew ready"
|
||||
|
||||
# =============================================================================
|
||||
# Installation Menu
|
||||
# =============================================================================
|
||||
|
||||
phase "Mission Configuration"
|
||||
|
||||
echo "Select your mission parameters:"
|
||||
echo ""
|
||||
|
||||
# Installation options
|
||||
INSTALL_PACKAGES=false
|
||||
INSTALL_APPS=false
|
||||
SETUP_DOTFILES=false
|
||||
SETUP_MACOS=false
|
||||
SETUP_SECURITY=false
|
||||
BACKUP_CURRENT=false
|
||||
|
||||
if ask "📦 Install CLI tools and development packages?"; then
|
||||
INSTALL_PACKAGES=true
|
||||
fi
|
||||
|
||||
if ask "🖥️ Install applications (casks + Mac App Store)?"; then
|
||||
INSTALL_APPS=true
|
||||
fi
|
||||
|
||||
if ask "🔗 Set up dotfiles and symlinks?"; then
|
||||
SETUP_DOTFILES=true
|
||||
fi
|
||||
|
||||
if ask "⚙️ Configure macOS system preferences?"; then
|
||||
SETUP_MACOS=true
|
||||
fi
|
||||
|
||||
if ask "🛡️ Apply security hardening?"; then
|
||||
SETUP_SECURITY=true
|
||||
fi
|
||||
|
||||
if ask "💾 Backup current configurations first?" n; then
|
||||
BACKUP_CURRENT=true
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${CYAN}Mission parameters confirmed. Engaging...${NC}"
|
||||
|
||||
# =============================================================================
|
||||
# Backup Phase
|
||||
# =============================================================================
|
||||
|
||||
if [[ "$BACKUP_CURRENT" == true ]]; then
|
||||
phase "Creating Backup"
|
||||
|
||||
progress "Backing up current dotfiles..."
|
||||
if [[ -f "$HOME/dotfiles/bin/backup-dotfiles" ]]; then
|
||||
bash "$HOME/dotfiles/bin/backup-dotfiles"
|
||||
fi
|
||||
|
||||
progress "Backing up macOS settings..."
|
||||
if [[ -f "$HOME/dotfiles/macos/backup-defaults.sh" ]]; then
|
||||
bash "$HOME/dotfiles/macos/backup-defaults.sh"
|
||||
fi
|
||||
|
||||
success "Backup complete"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# Package Installation Phase
|
||||
# =============================================================================
|
||||
|
||||
if [[ "$INSTALL_PACKAGES" == true ]]; then
|
||||
phase "Installing Development Tools"
|
||||
|
||||
progress "Updating Homebrew..."
|
||||
brew update
|
||||
|
||||
progress "Installing command-line tools..."
|
||||
brew bundle install --file="$HOME/dotfiles/Brewfile" --no-mas --no-cask
|
||||
|
||||
success "CLI tools installed"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# Application Installation Phase
|
||||
# =============================================================================
|
||||
|
||||
if [[ "$INSTALL_APPS" == true ]]; then
|
||||
phase "Installing Applications"
|
||||
|
||||
# Install Mac App Store CLI if not present
|
||||
if ! command_exists mas; then
|
||||
progress "Installing mas (Mac App Store CLI)..."
|
||||
brew install mas
|
||||
fi
|
||||
|
||||
# Check if signed into Mac App Store
|
||||
if ! mas account >/dev/null 2>&1; then
|
||||
warning "Not signed into Mac App Store"
|
||||
echo "Please sign in to the Mac App Store and run 'mas install' commands manually"
|
||||
echo "Or run: brew bundle install --file=$HOME/dotfiles/Brewfile"
|
||||
fi
|
||||
|
||||
progress "Installing cask applications..."
|
||||
brew bundle install --file="$HOME/dotfiles/Brewfile" --no-brew --no-mas
|
||||
|
||||
if mas account >/dev/null 2>&1; then
|
||||
progress "Installing Mac App Store applications..."
|
||||
brew bundle install --file="$HOME/dotfiles/Brewfile" --no-brew --no-cask
|
||||
fi
|
||||
|
||||
success "Applications installed"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# Dotfiles Configuration Phase
|
||||
# =============================================================================
|
||||
|
||||
if [[ "$SETUP_DOTFILES" == true ]]; then
|
||||
phase "Configuring Dotfiles"
|
||||
|
||||
progress "Creating symlinks..."
|
||||
bash "$HOME/dotfiles/scripts/symlinks.sh"
|
||||
|
||||
progress "Setting up shell enhancements..."
|
||||
# Reload shell configuration
|
||||
if [[ -f "$HOME/.zshrc" ]]; then
|
||||
source "$HOME/.zshrc" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
progress "Setting up Obsidian configuration..."
|
||||
if [[ -f "$HOME/dotfiles/obsidian/setup-obsidian.sh" ]]; then
|
||||
bash "$HOME/dotfiles/obsidian/setup-obsidian.sh"
|
||||
fi
|
||||
|
||||
success "Dotfiles configured"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# macOS Configuration Phase
|
||||
# =============================================================================
|
||||
|
||||
if [[ "$SETUP_MACOS" == true ]]; then
|
||||
phase "Configuring macOS System"
|
||||
|
||||
if ask "Use interactive mode for system preferences?" y; then
|
||||
bash "$HOME/dotfiles/macos/defaults-interactive.sh"
|
||||
else
|
||||
bash "$HOME/dotfiles/macos/defaults.sh"
|
||||
fi
|
||||
|
||||
success "macOS system configured"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# Security Configuration Phase
|
||||
# =============================================================================
|
||||
|
||||
if [[ "$SETUP_SECURITY" == true ]]; then
|
||||
phase "Applying Security Configuration"
|
||||
|
||||
progress "Hardening system security..."
|
||||
bash "$HOME/dotfiles/macos/security.sh"
|
||||
|
||||
progress "Setting up keyboard shortcuts..."
|
||||
bash "$HOME/dotfiles/macos/keyboard-shortcuts.sh"
|
||||
|
||||
success "Security configuration applied"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# Mission Complete
|
||||
# =============================================================================
|
||||
|
||||
phase "Mission Status Report"
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}${BOLD}🎉 MISSION ACCOMPLISHED! 🎉${NC}"
|
||||
echo ""
|
||||
echo -e "${CYAN}Your macOS system has been successfully configured.${NC}"
|
||||
echo ""
|
||||
echo -e "${YELLOW}Final Steps:${NC}"
|
||||
echo "1. 🔄 Restart your terminal or run: source ~/.zshrc"
|
||||
echo "2. 🔐 Review SSH configuration: ~/.ssh/config"
|
||||
echo "3. 🧩 Install Obsidian plugins manually (see ~/dotfiles/obsidian/)"
|
||||
echo "4. 🔍 Review security settings in System Preferences"
|
||||
echo "5. 🚀 Log out and back in for all changes to take effect"
|
||||
echo ""
|
||||
|
||||
if [[ "$INSTALL_APPS" == true ]]; then
|
||||
echo -e "${YELLOW}Application Notes:${NC}"
|
||||
echo "• Configure 1Password and import data"
|
||||
echo "• Set up LaunchBar activation key"
|
||||
echo "• Import Hazel rules if you have backups"
|
||||
echo "• Configure Bartender menu bar layout"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
echo -e "${CYAN}${BOLD}\"Make it so!\" - Setup complete. 🖖${NC}"
|
||||
echo ""
|
||||
|
||||
# Optional: Open useful apps
|
||||
if ask "Open useful applications to get started?" n; then
|
||||
open -a "System Preferences"
|
||||
open -a "iTerm" 2>/dev/null || open -a "Terminal"
|
||||
if [[ -d "/Applications/1Password.app" ]]; then
|
||||
open -a "1Password"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Live long and prosper! 🖖✨${NC}"
|
||||
Reference in New Issue
Block a user