#!/usr/bin/env bash # macos-defaults.sh — opinionated macOS preferences applied during restore. # Override by setting SSR_MACOS_DEFAULTS in your config to your own script. # Each block is independent; failures are logged but do not abort the script. set -uo pipefail run() { if ! "$@"; then printf '[macos-defaults] failed: %s\n' "$*" >&2 fi } # Dock: position + appearance run defaults write com.apple.dock pinning -string middle run defaults write com.apple.dock mouse-over-hilte-stack -bool true # Dock: recent applications stack run defaults write com.apple.dock persistent-others -array-add \ '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }' # Login window message (requires sudo; skipped without) if sudo -n true 2>/dev/null; then run sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "Welcome back..." fi # Time Machine on unsupported network volumes run defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes -bool true # Mail: prefer plain text run defaults write com.apple.mail PreferPlainText -bool true # Finder: show hidden files + path bar run defaults write com.apple.finder AppleShowAllFiles -bool true run defaults write com.apple.finder ShowPathbar -bool true # Screenshots: save to ~/Pictures/Screenshots as PNG mkdir -p "$HOME/Pictures/Screenshots" run defaults write com.apple.screencapture location -string "$HOME/Pictures/Screenshots" run defaults write com.apple.screencapture type -string png # Reload affected services killall Dock 2>/dev/null || true killall Finder 2>/dev/null || true killall SystemUIServer 2>/dev/null || true