setup.sh (1840B)
1 #!/usr/bin/env bash 2 set -euo pipefail 3 4 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 6 # Change default shell to fish 7 if command -v fish &>/dev/null; then 8 FISH_PATH="$(which fish)" 9 if [ "$SHELL" != "$FISH_PATH" ]; then 10 echo "Changing default shell to fish..." 11 if ! grep -q "^$FISH_PATH$" /etc/shells 2>/dev/null; then 12 echo "$FISH_PATH" | sudo tee -a /etc/shells >/dev/null 13 fi 14 chsh -s "$FISH_PATH" 15 fi 16 fi 17 18 # Homebrew 19 echo "🍺 Installing Homebrew packages with Brewfile..." 20 if ! command -v brew >/dev/null 2>&1; then 21 echo "❌ Homebrew not found. Please install it first: https://brew.sh" 22 exit 1 23 fi 24 brew update && echo "✅ Homebrew updated" 25 brew upgrade && echo "✅ Homebrew upgraded" 26 BREWFILE_PATH="${SCRIPT_DIR}/Brewfile" 27 if [ -f "$BREWFILE_PATH" ]; then 28 brew bundle --file="$BREWFILE_PATH" && echo "✅ Brewfile installed successfully" 29 brew bundle check --file="$BREWFILE_PATH" && echo "✅ Brewfile verification passed" || echo "⚠️ Brewfile verification issues" 30 else 31 echo "❌ Brewfile not found at $BREWFILE_PATH" 32 exit 1 33 fi 34 brew cleanup && echo "✅ Homebrew cleanup completed" 35 36 # Symlink configs 37 "$SCRIPT_DIR/link.sh" 38 39 # Dock configuration 40 echo "🎨 Configuring Dock..." 41 defaults write com.apple.dock orientation -string "left" 42 defaults write com.apple.dock autohide -bool true 43 defaults write com.apple.dock show-recents -bool false 44 killall Dock 45 echo "✅ Dock configured (left position, autohide, no recent items)" 46 47 # System preferences 48 echo "⚙️ Configuring system preferences..." 49 defaults write NSGlobalDomain AppleICUForce24HourTime -bool true 50 defaults write com.apple.menuextra.clock Show24Hour -bool true 51 defaults write com.apple.menuextra.clock ShowSeconds -bool true 52 killall SystemUIServer 53 echo "✅ System preferences configured (24-hour clock)" 54 55 echo "✅ Setup script completed!"