- Configure Safari to open with all windows from last session - Include fallback warning if Safari's containerized preferences are inaccessible Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
44 lines
1.5 KiB
Bash
Executable File
44 lines
1.5 KiB
Bash
Executable File
#! /usr/bin/env bash
|
|
|
|
# Configures macOS system preferences.
|
|
|
|
set -o nounset
|
|
set -o errexit
|
|
set -o pipefail
|
|
IFS=$'\n\t'
|
|
|
|
printf "\n🔧 Configuring macOS system preferences...\n\n"
|
|
|
|
# Hide the Dock
|
|
printf " • Hiding Dock automatically...\n"
|
|
defaults write com.apple.dock autohide -bool true
|
|
|
|
# Show hard disks on desktop
|
|
printf " • Showing hard disks on desktop...\n"
|
|
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
|
|
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
|
|
|
|
# Show user home folder in Finder sidebar
|
|
printf " • Adding user home folder to Finder sidebar...\n"
|
|
defaults write com.apple.sidebarlists systemitems -dict-add ShowUserHome -bool true
|
|
|
|
# Show all file extensions
|
|
printf " • Showing all file extensions...\n"
|
|
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
|
|
|
|
# Remove items from trash after 30 days
|
|
printf " • Setting trash to empty after 30 days...\n"
|
|
defaults write com.apple.finder FXRemoveOldTrashItems -bool true
|
|
|
|
# Safari: Open with all windows from last session
|
|
printf " • Configuring Safari to restore all windows from last session...\n"
|
|
defaults write com.apple.Safari AlwaysRestoreSessionAtLaunch -bool true 2>/dev/null || \
|
|
printf " ⚠ Safari preference may need to be set manually in Safari > Settings > General\n"
|
|
|
|
# Restart affected applications
|
|
printf "\n🔄 Restarting Finder and Dock to apply changes...\n"
|
|
killall Finder
|
|
killall Dock
|
|
|
|
printf "\n✅ macOS system preferences configured successfully!\n"
|