Tutorial

Neue Updates und Verbesserungen zu Macfleet.

Wichtiger Hinweis

Die in diesen Tutorials bereitgestellten Codebeispiele und Skripte dienen nur zu Bildungszwecken. Macfleet ist nicht verantwortlich für Probleme, Schäden oder Sicherheitslücken, die durch die Verwendung, Änderung oder Implementierung dieser Beispiele entstehen können. Überprüfen und testen Sie Code immer in einer sicheren Umgebung, bevor Sie ihn in Produktionssystemen verwenden.

Configure Stage Manager on macOS Devices

Stage Manager is a powerful window management feature introduced in macOS Ventura that helps users organize and focus on their work by grouping windows and hiding inactive applications. This tutorial shows you how to manage Stage Manager settings across your Mac fleet using shell scripts.

What is Stage Manager?

Stage Manager is a window management system that:

  • Organizes windows into focused groups on the desktop
  • Reduces visual clutter by hiding inactive applications
  • Improves productivity by allowing users to switch between different work contexts
  • Supports external displays with independent Stage Manager controls
  • Integrates with Mission Control for enhanced window management

Prerequisites and Compatibility

System Requirements

  • macOS 13.0 (Ventura) or later - Stage Manager is not available on earlier versions
  • Supported devices: Mac computers with Apple Silicon (M1, M2, M3, M4) or Intel processors
  • Administrative privileges for script execution

Hardware Compatibility

Stage Manager works best on:

  • MacBook Pro and MacBook Air (2018 or later)
  • iMac (2019 or later)
  • Mac Studio (all models)
  • Mac Pro (2019 or later)
  • Mac mini (2018 or later)

Basic Stage Manager Management

Enable Stage Manager

#!/bin/bash

# Script to enable Stage Manager on macOS
CurrentUser=$(ls -l /dev/console | awk '/ / { print $3 }')
CurrentUserUID=$(id -u "$CurrentUser")

echo "MacFleet Stage Manager Enablement"
echo "Current user: $CurrentUser"
echo "Current user UID: $CurrentUserUID"

# Enable Stage Manager globally
launchctl asuser $CurrentUserUID sudo -iu "$CurrentUser" defaults write com.apple.WindowManager GloballyEnabled -bool true

echo "✅ Stage Manager has been enabled for user $CurrentUser"
echo "Changes will take effect after the next login or window manager restart"

Disable Stage Manager

#!/bin/bash

# Script to disable Stage Manager on macOS
CurrentUser=$(ls -l /dev/console | awk '/ / { print $3 }')
CurrentUserUID=$(id -u "$CurrentUser")

echo "MacFleet Stage Manager Disablement"
echo "Current user: $CurrentUser"
echo "Current user UID: $CurrentUserUID"

# Disable Stage Manager globally
launchctl asuser $CurrentUserUID sudo -iu "$CurrentUser" defaults write com.apple.WindowManager GloballyEnabled -bool false

echo "❌ Stage Manager has been disabled for user $CurrentUser"
echo "Changes will take effect after the next login or window manager restart"

Advanced Stage Manager Configuration

Comprehensive Stage Manager Management Script

#!/bin/bash

# Advanced Stage Manager management for Mac fleet
DEVICE_NAME=$(scutil --get ComputerName)
CURRENT_USER=$(ls -l /dev/console | awk '/ / { print $3 }')
CURRENT_USER_UID=$(id -u "$CURRENT_USER")
MACOS_VERSION=$(sw_vers -productVersion)
LOG_FILE="/var/log/macfleet_stage_manager.log"

# Function to log messages
log_message() {
    echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a "$LOG_FILE"
}

# Function to check macOS version compatibility
check_compatibility() {
    local major_version=$(echo "$MACOS_VERSION" | cut -d. -f1)
    local minor_version=$(echo "$MACOS_VERSION" | cut -d. -f2)
    
    if [ "$major_version" -ge 13 ]; then
        echo "✅ macOS $MACOS_VERSION is compatible with Stage Manager"
        return 0
    else
        echo "❌ macOS $MACOS_VERSION is not compatible with Stage Manager (requires 13.0+)"
        return 1
    fi
}

# Function to get current Stage Manager status
get_stage_manager_status() {
    local status=$(launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults read com.apple.WindowManager GloballyEnabled 2>/dev/null)
    case "$status" in
        1) echo "enabled" ;;
        0) echo "disabled" ;;
        *) echo "undefined" ;;
    esac
}

# Function to enable Stage Manager
enable_stage_manager() {
    launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager GloballyEnabled -bool true
    log_message "Stage Manager enabled on $DEVICE_NAME for user $CURRENT_USER"
}

# Function to disable Stage Manager
disable_stage_manager() {
    launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager GloballyEnabled -bool false
    log_message "Stage Manager disabled on $DEVICE_NAME for user $CURRENT_USER"
}

# Function to configure recent apps visibility
configure_recent_apps() {
    local show_recent="$1"
    
    if [ "$show_recent" = "true" ]; then
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AutoHide -bool false
        log_message "Recent apps visibility enabled"
        echo "✅ Recent applications will be visible on the left side"
    else
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AutoHide -bool true
        log_message "Recent apps visibility disabled"
        echo "❌ Recent applications will be hidden"
    fi
}

# Function to configure window grouping behavior
configure_window_grouping() {
    local grouping_mode="$1"
    
    case "$grouping_mode" in
        "all_at_once")
            launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool false
            log_message "Window grouping set to 'All at Once'"
            echo "✅ Window grouping: All at Once"
            ;;
        "one_at_time")
            launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool true
            log_message "Window grouping set to 'One at a Time'"
            echo "✅ Window grouping: One at a Time"
            ;;
        *)
            echo "❌ Invalid grouping mode. Use 'all_at_once' or 'one_at_time'"
            return 1
            ;;
    esac
}

# Function to restart Window Manager
restart_window_manager() {
    launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" killall WindowManager 2>/dev/null
    sleep 2
    log_message "Window Manager restarted for user $CURRENT_USER"
}

# Function to validate Stage Manager configuration
validate_configuration() {
    local expected_state="$1"
    local current_state=$(get_stage_manager_status)
    
    if [ "$current_state" = "$expected_state" ]; then
        echo "✅ Configuration validation successful: Stage Manager is $expected_state"
        return 0
    else
        echo "❌ Configuration validation failed: Expected $expected_state, got $current_state"
        return 1
    fi
}

# Main execution
echo "MacFleet Stage Manager Configuration"
echo "==================================="
echo "Device: $DEVICE_NAME"
echo "User: $CURRENT_USER"
echo "macOS Version: $MACOS_VERSION"
echo ""

log_message "Starting Stage Manager configuration on $DEVICE_NAME"

# Check compatibility
if ! check_compatibility; then
    log_message "Stage Manager configuration aborted due to compatibility issues"
    exit 1
fi

# Display current status
echo "Current Stage Manager status: $(get_stage_manager_status)"
echo ""

# Configuration options (uncomment as needed)
# enable_stage_manager
# disable_stage_manager
# configure_recent_apps "true"
# configure_window_grouping "all_at_once"
# restart_window_manager

log_message "Stage Manager configuration completed"

Interactive Stage Manager Configuration

#!/bin/bash

# Interactive Stage Manager configuration tool
CURRENT_USER=$(ls -l /dev/console | awk '/ / { print $3 }')
CURRENT_USER_UID=$(id -u "$CURRENT_USER")
MACOS_VERSION=$(sw_vers -productVersion)

# Function to get current Stage Manager status
get_stage_manager_status() {
    local status=$(launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults read com.apple.WindowManager GloballyEnabled 2>/dev/null)
    case "$status" in
        1) echo "enabled" ;;
        0) echo "disabled" ;;
        *) echo "not configured" ;;
    esac
}

# Function to get recent apps setting
get_recent_apps_status() {
    local status=$(launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults read com.apple.WindowManager AutoHide 2>/dev/null)
    case "$status" in
        1) echo "hidden" ;;
        0) echo "visible" ;;
        *) echo "not configured" ;;
    esac
}

# Function to get window grouping setting
get_window_grouping_status() {
    local status=$(launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults read com.apple.WindowManager AppWindowGroupingBehavior 2>/dev/null)
    case "$status" in
        1) echo "one at a time" ;;
        0) echo "all at once" ;;
        *) echo "not configured" ;;
    esac
}

# Function to display current configuration
display_current_config() {
    echo "Current Stage Manager Configuration:"
    echo "==================================="
    echo "Stage Manager: $(get_stage_manager_status)"
    echo "Recent Apps: $(get_recent_apps_status)"
    echo "Window Grouping: $(get_window_grouping_status)"
    echo ""
}

# Main interactive menu
echo "MacFleet Stage Manager Interactive Configuration"
echo "==============================================="
echo "Device: $(scutil --get ComputerName)"
echo "User: $CURRENT_USER"
echo "macOS Version: $MACOS_VERSION"
echo ""

# Check compatibility
major_version=$(echo "$MACOS_VERSION" | cut -d. -f1)
if [ "$major_version" -lt 13 ]; then
    echo "❌ Stage Manager requires macOS 13.0 or later"
    echo "Current version: $MACOS_VERSION"
    exit 1
fi

display_current_config

echo "Configuration Options:"
echo "1. Enable Stage Manager"
echo "2. Disable Stage Manager"
echo "3. Show recent applications"
echo "4. Hide recent applications"
echo "5. Set window grouping to 'All at Once'"
echo "6. Set window grouping to 'One at a Time'"
echo "7. Apply recommended settings"
echo "8. Reset to defaults"
echo "9. Display current configuration"
echo "0. Exit"
echo ""

read -p "Enter your choice (0-9): " choice

case $choice in
    1)
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager GloballyEnabled -bool true
        echo "✅ Stage Manager enabled"
        ;;
    2)
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager GloballyEnabled -bool false
        echo "❌ Stage Manager disabled"
        ;;
    3)
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AutoHide -bool false
        echo "✅ Recent applications will be visible"
        ;;
    4)
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AutoHide -bool true
        echo "❌ Recent applications will be hidden"
        ;;
    5)
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool false
        echo "✅ Window grouping set to 'All at Once'"
        ;;
    6)
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool true
        echo "✅ Window grouping set to 'One at a Time'"
        ;;
    7)
        # Apply recommended enterprise settings
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager GloballyEnabled -bool true
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AutoHide -bool false
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool false
        echo "✅ Applied recommended enterprise settings"
        ;;
    8)
        # Reset to system defaults
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults delete com.apple.WindowManager GloballyEnabled 2>/dev/null
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults delete com.apple.WindowManager AutoHide 2>/dev/null
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults delete com.apple.WindowManager AppWindowGroupingBehavior 2>/dev/null
        echo "✅ Reset to system defaults"
        ;;
    9)
        display_current_config
        ;;
    0)
        echo "Exiting..."
        exit 0
        ;;
    *)
        echo "Invalid choice. Please try again."
        ;;
esac

echo ""
echo "Configuration updated. Changes may require logout/login to take full effect."
echo "You can verify the changes in System Settings > Desktop & Dock > Stage Manager."

Enterprise Deployment Scripts

Bulk Stage Manager Configuration

#!/bin/bash

# Enterprise Stage Manager deployment script
COMPANY_NAME="MacFleet"
DEPLOYMENT_DATE=$(date +"%Y-%m-%d")
LOG_FILE="/var/log/macfleet_stage_manager_deployment.log"
REPORT_FILE="/tmp/stage_manager_deployment_report_$(date +%Y%m%d_%H%M%S).txt"

# Configuration settings
STAGE_MANAGER_ENABLED=true
RECENT_APPS_VISIBLE=true
WINDOW_GROUPING_MODE="all_at_once"  # Options: "all_at_once" or "one_at_time"
RESTART_WINDOW_MANAGER=true

# Function to log messages
log_message() {
    echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a "$LOG_FILE"
}

# Function to check macOS compatibility
check_macos_compatibility() {
    local macos_version=$(sw_vers -productVersion)
    local major_version=$(echo "$macos_version" | cut -d. -f1)
    
    if [ "$major_version" -ge 13 ]; then
        log_message "macOS $macos_version is compatible with Stage Manager"
        return 0
    else
        log_message "macOS $macos_version is not compatible with Stage Manager"
        return 1
    fi
}

# Function to get device information
get_device_info() {
    local device_name=$(scutil --get ComputerName)
    local device_serial=$(system_profiler SPHardwareDataType | grep "Serial Number" | awk '{print $4}')
    local macos_version=$(sw_vers -productVersion)
    local current_user=$(ls -l /dev/console | awk '/ / { print $3 }')
    local hardware_model=$(system_profiler SPHardwareDataType | grep "Model Name" | cut -d: -f2 | xargs)
    
    echo "Device: $device_name"
    echo "Serial: $device_serial"
    echo "Hardware: $hardware_model"
    echo "macOS: $macos_version"
    echo "User: $current_user"
}

# Function to deploy Stage Manager configuration
deploy_stage_manager_config() {
    local current_user=$(ls -l /dev/console | awk '/ / { print $3 }')
    local current_user_uid=$(id -u "$current_user")
    
    # Enable/disable Stage Manager
    if [ "$STAGE_MANAGER_ENABLED" = true ]; then
        launchctl asuser $current_user_uid sudo -iu "$current_user" defaults write com.apple.WindowManager GloballyEnabled -bool true
        log_message "Stage Manager enabled for user $current_user"
        echo "✅ Stage Manager enabled"
    else
        launchctl asuser $current_user_uid sudo -iu "$current_user" defaults write com.apple.WindowManager GloballyEnabled -bool false
        log_message "Stage Manager disabled for user $current_user"
        echo "❌ Stage Manager disabled"
    fi
    
    # Configure recent apps visibility
    if [ "$RECENT_APPS_VISIBLE" = true ]; then
        launchctl asuser $current_user_uid sudo -iu "$current_user" defaults write com.apple.WindowManager AutoHide -bool false
        log_message "Recent apps visibility enabled"
        echo "✅ Recent apps will be visible"
    else
        launchctl asuser $current_user_uid sudo -iu "$current_user" defaults write com.apple.WindowManager AutoHide -bool true
        log_message "Recent apps visibility disabled"
        echo "❌ Recent apps will be hidden"
    fi
    
    # Configure window grouping behavior
    case "$WINDOW_GROUPING_MODE" in
        "all_at_once")
            launchctl asuser $current_user_uid sudo -iu "$current_user" defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool false
            log_message "Window grouping set to 'All at Once'"
            echo "✅ Window grouping: All at Once"
            ;;
        "one_at_time")
            launchctl asuser $current_user_uid sudo -iu "$current_user" defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool true
            log_message "Window grouping set to 'One at a Time'"
            echo "✅ Window grouping: One at a Time"
            ;;
    esac
    
    # Restart Window Manager if requested
    if [ "$RESTART_WINDOW_MANAGER" = true ]; then
        launchctl asuser $current_user_uid sudo -iu "$current_user" killall WindowManager 2>/dev/null
        sleep 2
        log_message "Window Manager restarted"
        echo "🔄 Window Manager restarted"
    fi
}

# Function to validate deployment
validate_deployment() {
    local current_user=$(ls -l /dev/console | awk '/ / { print $3 }')
    local current_user_uid=$(id -u "$current_user")
    
    local stage_manager_status=$(launchctl asuser $current_user_uid sudo -iu "$current_user" defaults read com.apple.WindowManager GloballyEnabled 2>/dev/null)
    local recent_apps_status=$(launchctl asuser $current_user_uid sudo -iu "$current_user" defaults read com.apple.WindowManager AutoHide 2>/dev/null)
    local window_grouping_status=$(launchctl asuser $current_user_uid sudo -iu "$current_user" defaults read com.apple.WindowManager AppWindowGroupingBehavior 2>/dev/null)
    
    local validation_success=true
    
    # Validate Stage Manager status
    if [ "$STAGE_MANAGER_ENABLED" = true ] && [ "$stage_manager_status" = "1" ]; then
        echo "✅ Stage Manager validation: PASSED"
    elif [ "$STAGE_MANAGER_ENABLED" = false ] && [ "$stage_manager_status" = "0" ]; then
        echo "✅ Stage Manager validation: PASSED"
    else
        echo "❌ Stage Manager validation: FAILED"
        validation_success=false
    fi
    
    # Validate recent apps setting
    if [ "$RECENT_APPS_VISIBLE" = true ] && [ "$recent_apps_status" = "0" ]; then
        echo "✅ Recent apps validation: PASSED"
    elif [ "$RECENT_APPS_VISIBLE" = false ] && [ "$recent_apps_status" = "1" ]; then
        echo "✅ Recent apps validation: PASSED"
    else
        echo "❌ Recent apps validation: FAILED"
        validation_success=false
    fi
    
    if [ "$validation_success" = true ]; then
        log_message "Deployment validation successful"
        return 0
    else
        log_message "Deployment validation failed"
        return 1
    fi
}

# Main deployment process
echo "$COMPANY_NAME Stage Manager Deployment" > "$REPORT_FILE"
echo "========================================" >> "$REPORT_FILE"
echo "Date: $DEPLOYMENT_DATE" >> "$REPORT_FILE"
echo "" >> "$REPORT_FILE"

get_device_info >> "$REPORT_FILE"
echo "" >> "$REPORT_FILE"

log_message "Starting Stage Manager deployment"
echo "Starting deployment..." >> "$REPORT_FILE"

# Check macOS compatibility
if ! check_macos_compatibility; then
    echo "Status: FAILED - Incompatible macOS version" >> "$REPORT_FILE"
    log_message "Deployment aborted due to macOS compatibility"
    exit 1
fi

# Deploy configuration
deploy_stage_manager_config

# Validate deployment
if validate_deployment; then
    echo "Status: SUCCESS" >> "$REPORT_FILE"
else
    echo "Status: FAILED" >> "$REPORT_FILE"
fi

log_message "Deployment completed"
echo "Deployment completed. Report saved to: $REPORT_FILE"
cat "$REPORT_FILE"

Stage Manager Monitoring and Reporting

#!/bin/bash

# Stage Manager monitoring and reporting script
CENTRAL_SERVER="your-macfleet-server.com"
DEVICE_ID=$(system_profiler SPHardwareDataType | grep "Serial Number" | awk '{print $4}')
REPORT_FILE="/tmp/stage_manager_report_${DEVICE_ID}.json"

# Function to create JSON report
create_json_report() {
    local device_name=$(scutil --get ComputerName)
    local device_user=$(ls -l /dev/console | awk '/ / { print $3 }')
    local device_user_uid=$(id -u "$device_user")
    local os_version=$(sw_vers -productVersion)
    local timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
    local hardware_model=$(system_profiler SPHardwareDataType | grep "Model Name" | cut -d: -f2 | xargs)
    
    # Get Stage Manager settings
    local stage_manager_enabled=$(launchctl asuser $device_user_uid sudo -iu "$device_user" defaults read com.apple.WindowManager GloballyEnabled 2>/dev/null)
    local recent_apps_hidden=$(launchctl asuser $device_user_uid sudo -iu "$device_user" defaults read com.apple.WindowManager AutoHide 2>/dev/null)
    local window_grouping=$(launchctl asuser $device_user_uid sudo -iu "$device_user" defaults read com.apple.WindowManager AppWindowGroupingBehavior 2>/dev/null)
    
    # Check if Stage Manager is supported
    local major_version=$(echo "$os_version" | cut -d. -f1)
    local stage_manager_supported=$([ "$major_version" -ge 13 ] && echo "true" || echo "false")
    
    cat > "$REPORT_FILE" << EOF
{
  "device_info": {
    "device_id": "$DEVICE_ID",
    "device_name": "$device_name",
    "hardware_model": "$hardware_model",
    "user": "$device_user",
    "os_version": "$os_version",
    "timestamp": "$timestamp"
  },
  "stage_manager": {
    "supported": $stage_manager_supported,
    "enabled": $([ "$stage_manager_enabled" = "1" ] && echo "true" || echo "false"),
    "configured": $([ -n "$stage_manager_enabled" ] && echo "true" || echo "false"),
    "recent_apps_hidden": $([ "$recent_apps_hidden" = "1" ] && echo "true" || echo "false"),
    "window_grouping_mode": "$([ "$window_grouping" = "1" ] && echo "one_at_time" || echo "all_at_once")"
  },
  "window_manager": {
    "process_running": $(pgrep -x "WindowManager" > /dev/null && echo "true" || echo "false"),
    "last_restart": "$(ps -p $(pgrep -x "WindowManager") -o lstart= 2>/dev/null | xargs)"
  }
}
EOF
}

# Function to collect usage statistics
collect_usage_stats() {
    local device_user=$(ls -l /dev/console | awk '/ / { print $3 }')
    local device_user_uid=$(id -u "$device_user")
    
    # Check if Stage Manager is currently active
    local stage_manager_active=$(launchctl asuser $device_user_uid sudo -iu "$device_user" defaults read com.apple.WindowManager GloballyEnabled 2>/dev/null)
    
    if [ "$stage_manager_active" = "1" ]; then
        echo "Stage Manager is currently active"
        
        # Get window count (approximation)
        local window_count=$(launchctl asuser $device_user_uid sudo -iu "$device_user" osascript -e 'tell application "System Events" to count windows of every application process' 2>/dev/null)
        echo "Current window count: $window_count"
        
        # Check if external displays are connected
        local display_count=$(system_profiler SPDisplaysDataType | grep -c "Display Type:")
        echo "Connected displays: $display_count"
    else
        echo "Stage Manager is not active"
    fi
}

# Main execution
echo "MacFleet Stage Manager Monitoring"
echo "================================="
echo "Device ID: $DEVICE_ID"

# Create monitoring report
create_json_report

# Collect usage statistics
collect_usage_stats

echo "Report generated: $REPORT_FILE"
echo "Stage Manager monitoring completed"

# Display report summary
echo ""
echo "Report Summary:"
echo "==============="
cat "$REPORT_FILE" | grep -E '"supported|enabled|configured"' | sed 's/[",]//g' | sed 's/^[ ]*//'

# Optional: Send to central server
# curl -X POST -H "Content-Type: application/json" -d @"$REPORT_FILE" "https://$CENTRAL_SERVER/api/stage-manager-reports"

Best Practices for Stage Manager Management

1. User Training and Adoption

  • Provide comprehensive training on Stage Manager features
  • Create user guides and documentation
  • Demonstrate productivity benefits
  • Offer personalized configurations based on user roles

2. Configuration Standards

  • Define organizational standards for Stage Manager settings
  • Create different profiles for different user types
  • Document approved configurations
  • Implement change management processes

3. Performance Considerations

  • Monitor system performance impact
  • Consider hardware capabilities when enabling Stage Manager
  • Test configurations on different device types
  • Provide rollback options

4. Integration with Other Tools

  • Coordinate with existing window management tools
  • Consider impact on screen sharing and remote access
  • Test with business applications
  • Ensure compatibility with accessibility features

Troubleshooting Common Issues

Issue: Stage Manager Not Available

# Check macOS version
macos_version=$(sw_vers -productVersion)
echo "macOS version: $macos_version"

# Check if running on compatible hardware
hardware_model=$(system_profiler SPHardwareDataType | grep "Model Name" | cut -d: -f2 | xargs)
echo "Hardware model: $hardware_model"

# Verify system requirements
if [[ "$macos_version" < "13.0" ]]; then
    echo "❌ Stage Manager requires macOS 13.0 or later"
fi

Issue: Changes Not Taking Effect

# Restart Window Manager
current_user=$(ls -l /dev/console | awk '/ / { print $3 }')
current_user_uid=$(id -u "$current_user")

launchctl asuser $current_user_uid sudo -iu "$current_user" killall WindowManager
sleep 3

# Verify process restart
if pgrep -x "WindowManager" > /dev/null; then
    echo "✅ Window Manager restarted successfully"
else
    echo "❌ Window Manager failed to restart"
fi

Issue: Permission Denied

# Check user permissions
current_user=$(ls -l /dev/console | awk '/ / { print $3 }')
echo "Current user: $current_user"

# Verify user context
id "$current_user"

# Check if user has necessary permissions
if groups "$current_user" | grep -q "admin"; then
    echo "✅ User has admin privileges"
else
    echo "❌ User does not have admin privileges"
fi

Issue: Settings Not Persisting

# Check preferences file
current_user=$(ls -l /dev/console | awk '/ / { print $3 }')
plist_file="/Users/$current_user/Library/Preferences/com.apple.WindowManager.plist"

if [ -f "$plist_file" ]; then
    echo "✅ Preferences file exists"
    ls -la "$plist_file"
else
    echo "❌ Preferences file not found"
fi

# Force preferences sync
defaults synchronize

Stage Manager Feature Deep Dive

Understanding Stage Manager Components

Stage Manager consists of several key components:

  1. Window Groups: Collections of related windows that appear together
  2. Stage: The main working area where active window groups are displayed
  3. Recent Applications: Sidebar showing recently used applications
  4. External Display Support: Independent Stage Manager operation on external displays

Advanced Configuration Options

#!/bin/bash

# Advanced Stage Manager configuration options
CURRENT_USER=$(ls -l /dev/console | awk '/ / { print $3 }')
CURRENT_USER_UID=$(id -u "$CURRENT_USER")

# Configure Stage Manager for external displays
configure_external_display_stage_manager() {
    local enable_external="$1"
    
    if [ "$enable_external" = "true" ]; then
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager StandardStageStripShowsFullDesktop -bool true
        echo "✅ External display Stage Manager enabled"
    else
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager StandardStageStripShowsFullDesktop -bool false
        echo "❌ External display Stage Manager disabled"
    fi
}

# Configure Stage Manager animation speed
configure_animation_speed() {
    local speed="$1"  # Values: 0.1 to 1.0
    
    if [[ "$speed" =~ ^[0-9]+\.?[0-9]*$ ]] && (( $(echo "$speed >= 0.1" | bc -l) )) && (( $(echo "$speed <= 1.0" | bc -l) )); then
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager StageManagerAnimationSpeed -float "$speed"
        echo "✅ Animation speed set to $speed"
    else
        echo "❌ Invalid animation speed. Use values between 0.1 and 1.0"
    fi
}

# Configure Stage Manager hotkeys
configure_hotkeys() {
    local enable_hotkeys="$1"
    
    if [ "$enable_hotkeys" = "true" ]; then
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager EnableHotKeys -bool true
        echo "✅ Stage Manager hotkeys enabled"
    else
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager EnableHotKeys -bool false
        echo "❌ Stage Manager hotkeys disabled"
    fi
}

# Example usage
# configure_external_display_stage_manager "true"
# configure_animation_speed "0.5"
# configure_hotkeys "true"

Conclusion

Stage Manager is a powerful productivity feature that can significantly improve window management workflows when properly configured. This comprehensive guide provides:

  • Basic enable/disable functionality for quick deployment
  • Advanced configuration options for customized user experiences
  • Enterprise deployment scripts for large-scale management
  • Monitoring and reporting tools for ongoing management
  • Troubleshooting guides for common issues

Regular implementation of Stage Manager management practices will help ensure your Mac fleet provides an optimal user experience while maintaining organizational standards and productivity goals.

For maximum effectiveness, consider integrating Stage Manager configuration with your existing Mac fleet management tools and user training programs.

Tutorial

Neue Updates und Verbesserungen zu Macfleet.

Konfiguration eines GitHub Actions Runners auf einem Mac Mini (Apple Silicon)

GitHub Actions Runner

GitHub Actions ist eine leistungsstarke CI/CD-Plattform, die es Ihnen ermöglicht, Ihre Software-Entwicklungsworkflows zu automatisieren. Während GitHub gehostete Runner anbietet, bieten selbst-gehostete Runner erhöhte Kontrolle und Anpassung für Ihr CI/CD-Setup. Dieses Tutorial führt Sie durch die Einrichtung, Konfiguration und Verbindung eines selbst-gehosteten Runners auf einem Mac mini zur Ausführung von macOS-Pipelines.

Voraussetzungen

Bevor Sie beginnen, stellen Sie sicher, dass Sie haben:

  • Einen Mac mini (registrieren Sie sich bei Macfleet)
  • Ein GitHub-Repository mit Administratorrechten
  • Einen installierten Paketmanager (vorzugsweise Homebrew)
  • Git auf Ihrem System installiert

Schritt 1: Ein dediziertes Benutzerkonto erstellen

Erstellen Sie zunächst ein dediziertes Benutzerkonto für den GitHub Actions Runner:

# Das 'gh-runner' Benutzerkonto erstellen
sudo dscl . -create /Users/gh-runner
sudo dscl . -create /Users/gh-runner UserShell /bin/bash
sudo dscl . -create /Users/gh-runner RealName "GitHub runner"
sudo dscl . -create /Users/gh-runner UniqueID "1001"
sudo dscl . -create /Users/gh-runner PrimaryGroupID 20
sudo dscl . -create /Users/gh-runner NFSHomeDirectory /Users/gh-runner

# Das Passwort für den Benutzer setzen
sudo dscl . -passwd /Users/gh-runner ihr_passwort

# 'gh-runner' zur 'admin'-Gruppe hinzufügen
sudo dscl . -append /Groups/admin GroupMembership gh-runner

Wechseln Sie zum neuen Benutzerkonto:

su gh-runner

Schritt 2: Erforderliche Software installieren

Installieren Sie Git und Rosetta 2 (wenn Sie Apple Silicon verwenden):

# Git installieren, falls noch nicht installiert
brew install git

# Rosetta 2 für Apple Silicon Macs installieren
softwareupdate --install-rosetta

Schritt 3: Den GitHub Actions Runner konfigurieren

  1. Gehen Sie zu Ihrem GitHub-Repository
  2. Navigieren Sie zu Einstellungen > Actions > Runners

GitHub Actions Runner

  1. Klicken Sie auf "New self-hosted runner" (https://github.com/<username>/<repository>/settings/actions/runners/new)
  2. Wählen Sie macOS als Runner-Image und ARM64 als Architektur
  3. Folgen Sie den bereitgestellten Befehlen, um den Runner herunterzuladen und zu konfigurieren

GitHub Actions Runner

Erstellen Sie eine .env-Datei im _work-Verzeichnis des Runners:

# _work/.env Datei
ImageOS=macos15
XCODE_15_DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
  1. Führen Sie das run.sh-Skript in Ihrem Runner-Verzeichnis aus, um die Einrichtung abzuschließen.
  2. Überprüfen Sie, dass der Runner aktiv ist und auf Jobs im Terminal wartet, und überprüfen Sie die GitHub-Repository-Einstellungen für die Runner-Zuordnung und den Idle-Status.

GitHub Actions Runner

Schritt 4: Sudoers konfigurieren (Optional)

Wenn Ihre Actions Root-Privilegien benötigen, konfigurieren Sie die sudoers-Datei:

sudo visudo

Fügen Sie die folgende Zeile hinzu:

gh-runner ALL=(ALL) NOPASSWD: ALL

Schritt 5: Den Runner in Workflows verwenden

Konfigurieren Sie Ihren GitHub Actions Workflow, um den selbst-gehosteten Runner zu verwenden:

name: Beispiel-Workflow

on:
  workflow_dispatch:

jobs:
  build:
    runs-on: [self-hosted, macOS, ARM64]
    steps:
      - name: NodeJS installieren
        run: brew install node

Der Runner ist bei Ihrem Repository authentifiziert und mit self-hosted, macOS und ARM64 markiert. Verwenden Sie ihn in Ihren Workflows, indem Sie diese Labels im runs-on-Feld angeben:

runs-on: [self-hosted, macOS, ARM64]

Best Practices

  • Halten Sie Ihre Runner-Software auf dem neuesten Stand
  • Überwachen Sie regelmäßig Runner-Logs auf Probleme
  • Verwenden Sie spezifische Labels für verschiedene Runner-Typen
  • Implementieren Sie angemessene Sicherheitsmaßnahmen
  • Erwägen Sie die Verwendung mehrerer Runner für Lastverteilung

Fehlerbehebung

Häufige Probleme und Lösungen:

  1. Runner verbindet sich nicht:

    • Überprüfen Sie die Netzwerkverbindung
    • Überprüfen Sie die Gültigkeit des GitHub-Tokens
    • Stellen Sie angemessene Berechtigungen sicher
  2. Build-Fehler:

    • Überprüfen Sie die Xcode-Installation
    • Überprüfen Sie erforderliche Abhängigkeiten
    • Überprüfen Sie Workflow-Logs
  3. Berechtigungsprobleme:

    • Überprüfen Sie Benutzerberechtigungen
    • Überprüfen Sie sudoers-Konfiguration
    • Überprüfen Sie Dateisystem-Berechtigungen

Fazit

Sie haben jetzt einen selbst-gehosteten GitHub Actions Runner auf Ihrem Mac mini konfiguriert. Diese Einrichtung bietet Ihnen mehr Kontrolle über Ihre CI/CD-Umgebung und ermöglicht es Ihnen, macOS-spezifische Workflows effizient auszuführen.

Denken Sie daran, Ihren Runner regelmäßig zu warten und ihn mit den neuesten Sicherheitspatches und Software-Versionen auf dem neuesten Stand zu halten.

Native App

Macfleet native App

Macfleet Installationsanleitung

Macfleet ist eine leistungsstarke Flottenmanagement-Lösung, die speziell für Cloud-gehostete Mac Mini-Umgebungen entwickelt wurde. Als Mac Mini Cloud-Hosting-Anbieter können Sie Macfleet verwenden, um Ihre gesamte Flotte virtualisierter Mac-Instanzen zu überwachen, zu verwalten und zu optimieren.

Diese Installationsanleitung führt Sie durch die Einrichtung der Macfleet-Überwachung auf macOS-, Windows- und Linux-Systemen, um eine umfassende Übersicht über Ihre Cloud-Infrastruktur zu gewährleisten.

🍎 macOS

  • Laden Sie die .dmg-Datei für Mac hier herunter
  • Doppelklicken Sie auf die heruntergeladene .dmg-Datei
  • Ziehen Sie die Macfleet-App in den Anwendungsordner
  • Werfen Sie die .dmg-Datei aus
  • Öffnen Sie Systemeinstellungen > Sicherheit & Datenschutz
    • Datenschutz-Tab > Bedienungshilfen
    • Aktivieren Sie Macfleet, um Überwachung zu erlauben
  • Starten Sie Macfleet aus den Anwendungen
  • Die Verfolgung startet automatisch

🪟 Windows

  • Laden Sie die .exe-Datei für Windows hier herunter
  • Rechtsklick auf die .exe-Datei > "Als Administrator ausführen"
  • Folgen Sie dem Installationsassistenten
  • Akzeptieren Sie die Allgemeinen Geschäftsbedingungen
  • Erlauben Sie in Windows Defender, wenn aufgefordert
  • Gewähren Sie Anwendungsüberwachungsberechtigungen
  • Starten Sie Macfleet aus dem Startmenü
  • Die Anwendung beginnt automatisch mit der Verfolgung

🐧 Linux

  • Laden Sie das .deb-Paket (Ubuntu/Debian) oder .rpm (CentOS/RHEL) hier herunter
  • Installieren Sie mit Ihrem Paketmanager
    • Ubuntu/Debian: sudo dpkg -i Macfleet-linux.deb
    • CentOS/RHEL: sudo rpm -ivh Macfleet-linux.rpm
  • Erlauben Sie X11-Zugriffsberechtigungen, wenn aufgefordert
  • Fügen Sie den Benutzer zu entsprechenden Gruppen hinzu, falls erforderlich
  • Starten Sie Macfleet aus dem Anwendungsmenü
  • Die Anwendung beginnt automatisch mit der Verfolgung

Hinweis: Nach der Installation auf allen Systemen melden Sie sich mit Ihren Macfleet-Anmeldedaten an, um Daten mit Ihrem Dashboard zu synchronisieren.