Tutorial

New updates and improvements to Roundfleet.

Important notice

The code examples and scripts provided in these tutorials are for educational purposes only. Roundfleet is not responsible for any issues, damages, or security vulnerabilities that may arise from the use, modification, or implementation of these examples. Always review and test code in a secure environment before using it in production systems.

Configure Screenshot Settings on macOS

Learn how to customize screenshot behavior on Mac devices including file format, save location, and naming conventions. Essential for standardizing screenshot settings across enterprise Mac fleets.

Change Screenshot Format

Change the default screenshot format from PNG to other formats:

#!/bin/bash

# Get current user context
CURRENT_USER=$(stat -f "%Su" /dev/console)
CURRENT_USER_UID=$(id -u "$CURRENT_USER")

# Configuration
SCREENSHOT_FORMAT="JPG"  # Options: PNG, JPG, PDF, PSD, TIFF, GIF, BMP

echo "Setting screenshot format to: $SCREENSHOT_FORMAT"

# Apply screenshot format setting
launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    defaults write com.apple.screencapture type "$SCREENSHOT_FORMAT"

# Restart SystemUIServer to apply changes
launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    killall SystemUIServer

echo "✅ Screenshot format changed to $SCREENSHOT_FORMAT"

Change Screenshot Location

Change the default save location from Desktop to another folder:

#!/bin/bash

# Get current user context
CURRENT_USER=$(stat -f "%Su" /dev/console)
CURRENT_USER_UID=$(id -u "$CURRENT_USER")

# Configuration
SCREENSHOT_LOCATION="$HOME/Downloads"  # Change to desired location

echo "Setting screenshot location to: $SCREENSHOT_LOCATION"

# Ensure directory exists
launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    mkdir -p "$SCREENSHOT_LOCATION"

# Apply screenshot location setting
launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    defaults write com.apple.screencapture location "$SCREENSHOT_LOCATION"

# Restart SystemUIServer to apply changes
launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    killall SystemUIServer

echo "✅ Screenshot location changed to $SCREENSHOT_LOCATION"

Change Screenshot Naming

Customize screenshot filename prefix and date/time inclusion:

#!/bin/bash

# Get current user context
CURRENT_USER=$(stat -f "%Su" /dev/console)
CURRENT_USER_UID=$(id -u "$CURRENT_USER")

# Configuration
SCREENSHOT_PREFIX="Roundfleet"  # Change prefix from "Screenshot"
INCLUDE_DATETIME="0"          # 0=exclude, 1=include date/time

echo "Setting screenshot prefix to: $SCREENSHOT_PREFIX"
echo "Include date/time: $INCLUDE_DATETIME"

# Apply screenshot naming settings
launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    defaults write com.apple.screencapture name "$SCREENSHOT_PREFIX"

launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    defaults write com.apple.screencapture include-date "$INCLUDE_DATETIME"

# Restart SystemUIServer to apply changes
launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    killall SystemUIServer

echo "✅ Screenshot naming updated"
if [[ "$INCLUDE_DATETIME" == "0" ]]; then
    echo "📝 New filename format: ${SCREENSHOT_PREFIX}.png"
else
    echo "📝 New filename format: ${SCREENSHOT_PREFIX} [date] at [time].png"
fi

Complete Screenshot Configuration

Comprehensive script to configure all screenshot settings at once:

#!/bin/bash

# Function to configure screenshot settings
configure_screenshot_settings() {
    local format="$1"
    local location="$2"
    local prefix="$3"
    local include_date="$4"
    
    # Get current user context
    local current_user=$(stat -f "%Su" /dev/console)
    local current_user_uid=$(id -u "$current_user")
    
    echo "=== Roundfleet Screenshot Configuration ==="
    echo "👤 User: $current_user"
    echo "📸 Format: $format"
    echo "📁 Location: $location"
    echo "📝 Prefix: $prefix"
    echo "📅 Include date/time: $include_date"
    echo "========================================"
    
    # Create location directory if needed
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        mkdir -p "$location"
    
    # Apply all screenshot settings
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        defaults write com.apple.screencapture type "$format"
    
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        defaults write com.apple.screencapture location "$location"
    
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        defaults write com.apple.screencapture name "$prefix"
    
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        defaults write com.apple.screencapture include-date "$include_date"
    
    # Restart SystemUIServer to apply all changes
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        killall SystemUIServer
    
    echo "✅ All screenshot settings applied successfully"
    
    # Show example filename
    if [[ "$include_date" == "0" ]]; then
        echo "📝 Example filename: ${prefix}.${format,,}"
    else
        echo "📝 Example filename: ${prefix} $(date '+%Y-%m-%d') at $(date '+%H.%M.%S').${format,,}"
    fi
}

# Enterprise configuration
SCREENSHOT_FORMAT="PNG"
SCREENSHOT_LOCATION="/Users/$(stat -f "%Su" /dev/console)/Pictures/Screenshots"
SCREENSHOT_PREFIX="Roundfleet-Screenshot"
INCLUDE_DATETIME="1"

# Apply configuration
configure_screenshot_settings "$SCREENSHOT_FORMAT" "$SCREENSHOT_LOCATION" "$SCREENSHOT_PREFIX" "$INCLUDE_DATETIME"

Reset to Default Settings

Restore screenshot settings to macOS defaults:

#!/bin/bash

# Get current user context
CURRENT_USER=$(stat -f "%Su" /dev/console)
CURRENT_USER_UID=$(id -u "$CURRENT_USER")

echo "🔄 Resetting screenshot settings to defaults..."

# Remove custom screenshot settings
launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    defaults delete com.apple.screencapture type 2>/dev/null || true

launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    defaults delete com.apple.screencapture location 2>/dev/null || true

launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    defaults delete com.apple.screencapture name 2>/dev/null || true

launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    defaults delete com.apple.screencapture include-date 2>/dev/null || true

# Restart SystemUIServer to apply changes
launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    killall SystemUIServer

echo "✅ Screenshot settings reset to defaults"
echo "📝 Default: PNG format, Desktop location, 'Screenshot' prefix with date/time"

Enterprise Deployment Script

Script for bulk deployment across multiple Mac devices:

#!/bin/bash

# Enterprise screenshot standardization
COMPANY_NAME="Roundfleet"
SCREENSHOT_CONFIG=(
    "format:PNG"
    "location:/Users/CURRENT_USER/Documents/Screenshots"
    "prefix:${COMPANY_NAME}-Screen"
    "include-date:1"
)

# Function to apply enterprise screenshot policy
apply_enterprise_screenshot_policy() {
    local current_user=$(stat -f "%Su" /dev/console)
    local current_user_uid=$(id -u "$current_user")
    
    echo "🏢 Applying Enterprise Screenshot Policy"
    echo "========================================="
    echo "Device: $(hostname)"
    echo "User: $current_user"
    echo "Timestamp: $(date)"
    
    # Parse configuration
    local format location prefix include_date
    for config in "${SCREENSHOT_CONFIG[@]}"; do
        IFS=':' read -r key value <<< "$config"
        # Replace CURRENT_USER placeholder
        value="${value//CURRENT_USER/$current_user}"
        
        case "$key" in
            "format") format="$value" ;;
            "location") location="$value" ;;
            "prefix") prefix="$value" ;;
            "include-date") include_date="$value" ;;
        esac
    done
    
    echo "📸 Format: $format"
    echo "📁 Location: $location"
    echo "📝 Prefix: $prefix"
    echo "📅 Include date: $include_date"
    
    # Create screenshots directory
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        mkdir -p "$location"
    
    # Apply settings
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        defaults write com.apple.screencapture type "$format"
    
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        defaults write com.apple.screencapture location "$location"
    
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        defaults write com.apple.screencapture name "$prefix"
    
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        defaults write com.apple.screencapture include-date "$include_date"
    
    # Apply changes
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        killall SystemUIServer
    
    echo "✅ Enterprise screenshot policy applied"
    echo "📊 Configuration complete on $(hostname)"
}

# Execute enterprise policy
apply_enterprise_screenshot_policy

Usage with Roundfleet

  1. Configure desired format, location, and naming in the script variables
  2. Deploy through Roundfleet's remote script execution
  3. Verify settings by taking a test screenshot
  4. Monitor compliance across device fleet

Supported File Formats

FormatDescriptionUse Case
PNGLossless compressionDefault, best quality
JPGLossy compressionSmaller file sizes
PDFVector formatDocument screenshots
TIFFHigh qualityProfessional imaging
GIFAnimation supportSimple graphics
BMPUncompressedWindows compatibility
PSDPhotoshop formatDesign workflows

Common Location Options

LocationPathPurpose
Desktop~/DesktopDefault location
Downloads~/DownloadsEasy access
Documents~/DocumentsOrganization
Pictures~/Pictures/ScreenshotsPhoto library
Custom/path/to/folderCompany specific

Troubleshooting

Settings not applied: Ensure SystemUIServer is restarted after changes Permission denied: Verify user context with launchctl asuser Directory not found: Ensure target directory exists before setting location

Related Tutorials

Configure Stage Manager on macOS Devices

Learn how to enable, disable, and customize Stage Manager settings on macOS devices using shell scripts for Mac fleet management.

Jul 7, 2025

Configure Trackpad Settings on macOS

Learn how to configure trackpad settings including tracking speed, click options, tap to click, and drag lock using shell scripts for enterprise deployment.

Jul 7, 2025

Time Zone Management on macOS

Comprehensive guide for enterprise time zone and date/time management on Roundfleet devices with automated synchronization, geographic compliance, policy enforcement, and centralized control.

Jul 7, 2025

System Preferences Management on macOS

Learn how to hide, disable, and manage System Preferences panes on macOS devices using command-line scripts for enterprise configuration and user restriction control.

Jul 7, 2025

System Information Management on macOS

Collect, analyze, and manage system information across macOS devices using advanced system profiling, automated data collection, and enterprise analytics for comprehensive device inventory and monitoring.

Jul 7, 2025

Manage System Settings Panels on macOS

Learn how to disable, hide, and manage System Settings panels on macOS Ventura and later versions using command-line scripts for enhanced enterprise security control.

Jul 7, 2025

Display Brightness Management and Energy Optimization on macOS

Learn how to control screen brightness, implement adaptive lighting policies, manage energy consumption, and optimize display settings on macOS devices for enterprise fleet management.

Jul 7, 2025

Device Naming and Identity Management on macOS

Manage device names, hostnames, and network identities across Roundfleet devices with standardized naming conventions, automated provisioning, and enterprise compliance features.

Jul 7, 2025