Set Screen Saver on macOS
Learn how to configure and deploy screen savers on Mac devices using scripts. This allows you to set custom slideshow styles, idle times, and photo sources across your Mac fleet.
Basic Screen Saver Setup
Configure a slideshow screen saver with custom settings:
#!/bin/bash
# Screen saver configuration
STYLE="Ken Burns"
IDLE_TIME=300 # 5 minutes in seconds
SHUFFLE_PHOTOS=true
PHOTOS_PATH="/System/Library/Screen Savers/Default Collections/1-National Geographic"
# Set screen saver style
defaults -currentHost write com.apple.screensaver moduleDict -dict moduleName "$STYLE"
# Set idle time before activation
defaults -currentHost write com.apple.screensaver idleTime -int $IDLE_TIME
# Configure photo shuffle
defaults -currentHost write com.apple.screensaver ShufflePhotos -bool $SHUFFLE_PHOTOS
# Set photos folder path
defaults -currentHost write com.apple.screensaver PhotosFolderPath "$PHOTOS_PATH"
echo "Screen saver configured: Style=$STYLE, IdleTime=${IDLE_TIME}s"
Available Screen Saver Styles
Choose from Apple's built-in slideshow styles:
#!/bin/bash
# Available screen saver styles
STYLES=(
"Floating"
"Flip-up"
"Reflections"
"Origami"
"Shifting Tiles"
"Sliding Panels"
"Photo Mobile"
"Holiday Mobile"
"Photo Wall"
"Vintage Prints"
"Ken Burns"
"Classic"
)
# Function to set screen saver style
set_screen_saver_style() {
local style="$1"
local idle_time="${2:-600}" # Default 10 minutes
local photos_path="${3:-/System/Library/Screen Savers/Default Collections}"
echo "Setting screen saver: $style"
# Configure screen saver
defaults -currentHost write com.apple.screensaver moduleDict -dict moduleName "$style"
defaults -currentHost write com.apple.screensaver idleTime -int $idle_time
defaults -currentHost write com.apple.screensaver PhotosFolderPath "$photos_path"
echo "Screen saver configured successfully"
}
# Example: Set Ken Burns style with 5-minute idle time
set_screen_saver_style "Ken Burns" 300 "/Users/Shared/ScreenSaver Photos"
Interactive Screen Saver Manager
Script with user-friendly interface for configuration:
#!/bin/bash
# Function to display available styles
show_styles() {
echo "Available Screen Saver Styles:"
echo "1. Floating"
echo "2. Flip-up"
echo "3. Reflections"
echo "4. Origami"
echo "5. Shifting Tiles"
echo "6. Sliding Panels"
echo "7. Photo Mobile"
echo "8. Holiday Mobile"
echo "9. Photo Wall"
echo "10. Vintage Prints"
echo "11. Ken Burns"
echo "12. Classic"
}
# Function to configure screen saver
configure_screen_saver() {
local style="$1"
local idle_minutes="$2"
local shuffle="$3"
local photos_folder="$4"
local idle_seconds=$((idle_minutes * 60))
# Set all configuration options
defaults -currentHost write com.apple.screensaver moduleDict -dict moduleName "$style"
defaults -currentHost write com.apple.screensaver idleTime -int $idle_seconds
defaults -currentHost write com.apple.screensaver ShufflePhotos -bool $shuffle
defaults -currentHost write com.apple.screensaver PhotosFolderPath "$photos_folder"
# Kill System Preferences to force refresh
killall "System Preferences" 2>/dev/null || true
echo "✓ Screen saver configured:"
echo " Style: $style"
echo " Idle time: $idle_minutes minutes"
echo " Shuffle photos: $shuffle"
echo " Photos folder: $photos_folder"
}
# Default configuration
STYLE="Ken Burns"
IDLE_MINUTES=10
SHUFFLE_PHOTOS=true
PHOTOS_FOLDER="/System/Library/Screen Savers/Default Collections/1-National Geographic"
# Configure with defaults
configure_screen_saver "$STYLE" "$IDLE_MINUTES" "$SHUFFLE_PHOTOS" "$PHOTOS_FOLDER"
Enterprise Screen Saver Deployment
Deploy standardized screen saver settings across multiple devices:
#!/bin/bash
# Corporate screen saver configuration
CORPORATE_CONFIG() {
# Company branding configuration
local style="Classic"
local idle_time=600 # 10 minutes
local photos_path="/Library/Desktop Pictures/Corporate"
local shuffle=false
echo "Deploying corporate screen saver settings..."
# Create corporate photos directory if it doesn't exist
if [[ ! -d "$photos_path" ]]; then
sudo mkdir -p "$photos_path"
echo "Created corporate photos directory: $photos_path"
fi
# Apply settings
defaults -currentHost write com.apple.screensaver moduleDict -dict moduleName "$style"
defaults -currentHost write com.apple.screensaver idleTime -int $idle_time
defaults -currentHost write com.apple.screensaver ShufflePhotos -bool $shuffle
defaults -currentHost write com.apple.screensaver PhotosFolderPath "$photos_path"
# Disable screen saver password requirement for corporate environment
defaults write com.apple.screensaver askForPassword -int 0
echo "Corporate screen saver configuration applied"
echo "Style: $style | Idle: ${idle_time}s | Shuffle: $shuffle"
}
# Apply corporate configuration
CORPORATE_CONFIG
Screen Saver Status and Management
Check current screen saver settings and manage configuration:
#!/bin/bash
# Function to display current screen saver settings
show_current_settings() {
echo "=== Current Screen Saver Settings ==="
# Get current style
local current_style=$(defaults -currentHost read com.apple.screensaver moduleDict 2>/dev/null | grep moduleName | cut -d'"' -f4)
# Get idle time
local idle_time=$(defaults -currentHost read com.apple.screensaver idleTime 2>/dev/null)
# Get shuffle setting
local shuffle=$(defaults -currentHost read com.apple.screensaver ShufflePhotos 2>/dev/null)
# Get photos path
local photos_path=$(defaults -currentHost read com.apple.screensaver PhotosFolderPath 2>/dev/null)
echo "Style: ${current_style:-Not set}"
echo "Idle time: ${idle_time:-Not set} seconds"
echo "Shuffle photos: ${shuffle:-Not set}"
echo "Photos folder: ${photos_path:-Not set}"
}
# Function to disable screen saver
disable_screen_saver() {
defaults -currentHost write com.apple.screensaver idleTime -int 0
echo "Screen saver disabled (idle time set to 0)"
}
# Function to enable screen saver with default settings
enable_screen_saver() {
defaults -currentHost write com.apple.screensaver idleTime -int 600
defaults -currentHost write com.apple.screensaver moduleDict -dict moduleName "Ken Burns"
echo "Screen saver enabled with default settings"
}
# Show current settings
show_current_settings
Usage with MacFleet
- Choose your preferred screen saver style from the available options
- Set idle time in seconds (0 disables screen saver)
- Configure photo shuffle and source folder path
- Deploy through MacFleet's remote script execution
- Monitor deployment in action history
Common Photo Paths
Location | Path |
---|---|
Default Collections | /System/Library/Screen Savers/Default Collections |
Desktop Pictures | /Library/Desktop Pictures |
User Pictures | /Users/username/Pictures |
Shared Folder | /Users/Shared/ScreenSaver Photos |
Troubleshooting
Settings not applied: Kill System Preferences and restart to refresh settings Photos not displaying: Verify folder path exists and contains image files Screen saver not activating: Check idle time setting and system sleep preferences
Note: Changes take effect immediately but may require restarting System Preferences to see in the GUI. Test configuration before mass deployment.