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:
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
# Backup current macOS defaults before applying new ones
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
BACKUP_DIR="$HOME/dotfiles/macos/backups"
|
||||
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
||||
BACKUP_FILE="$BACKUP_DIR/defaults_backup_${TIMESTAMP}.txt"
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo -e "${GREEN}Backing up current macOS defaults...${NC}"
|
||||
|
||||
# Create backup directory
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
# Domains to backup
|
||||
domains=(
|
||||
"NSGlobalDomain"
|
||||
"com.apple.dock"
|
||||
"com.apple.finder"
|
||||
"com.apple.Safari"
|
||||
"com.apple.screencapture"
|
||||
"com.apple.screensaver"
|
||||
"com.apple.ActivityMonitor"
|
||||
"com.apple.TextEdit"
|
||||
)
|
||||
|
||||
# Backup each domain
|
||||
{
|
||||
echo "# macOS Defaults Backup"
|
||||
echo "# Created: $(date)"
|
||||
echo "# System: $(sw_vers -productVersion)"
|
||||
echo ""
|
||||
} > "$BACKUP_FILE"
|
||||
|
||||
for domain in "${domains[@]}"; do
|
||||
echo -e "${YELLOW}Backing up $domain...${NC}"
|
||||
{
|
||||
echo "# ============================================="
|
||||
echo "# $domain"
|
||||
echo "# ============================================="
|
||||
defaults read "$domain" 2>/dev/null || echo "# No settings found for $domain"
|
||||
echo ""
|
||||
} >> "$BACKUP_FILE"
|
||||
done
|
||||
|
||||
# Backup specific important settings
|
||||
echo -e "${YELLOW}Backing up specific settings...${NC}"
|
||||
{
|
||||
echo "# ============================================="
|
||||
echo "# Specific Settings"
|
||||
echo "# ============================================="
|
||||
echo "# Dock position: $(defaults read com.apple.dock orientation 2>/dev/null || echo 'default')"
|
||||
echo "# Dock size: $(defaults read com.apple.dock tilesize 2>/dev/null || echo 'default')"
|
||||
echo "# Show hidden files: $(defaults read com.apple.finder AppleShowAllFiles 2>/dev/null || echo 'false')"
|
||||
echo "# Key repeat: $(defaults read NSGlobalDomain KeyRepeat 2>/dev/null || echo 'default')"
|
||||
echo "# Initial key repeat: $(defaults read NSGlobalDomain InitialKeyRepeat 2>/dev/null || echo 'default')"
|
||||
} >> "$BACKUP_FILE"
|
||||
|
||||
echo -e "${GREEN}✓ Backup saved to: $BACKUP_FILE${NC}"
|
||||
|
||||
# Keep only last 5 backups
|
||||
cd "$BACKUP_DIR"
|
||||
ls -t defaults_backup_*.txt 2>/dev/null | tail -n +6 | xargs -r rm
|
||||
|
||||
echo -e "${GREEN}Backup complete!${NC}"
|
||||
Reference in New Issue
Block a user