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.

Manage Badge Notifications on macOS

Control and manage badge notifications across your MacFleet devices using command-line tools. This tutorial covers removing badge notifications for specific apps, managing dock-wide notifications, and implementing enterprise notification policies.

Understanding Badge Notifications

Badge notifications are the red circular icons that appear above application icons in the macOS dock, typically displaying numbers to indicate unread items like emails, messages, or updates. While useful for individual users, enterprise environments often require centralized notification management.

Key Features

  • App-specific control - Remove badges from individual applications
  • Dock-wide management - Clear all badge notifications at once
  • Automatic restoration - Badges reappear when applications are opened
  • System preference integration - Works with macOS notification settings

Remove Badge Notifications for Specific Apps

Basic Badge Removal

#!/bin/bash

# Remove badge notification for a specific application
APP_NAME="Mail"

defaults write com.apple.systempreferences AttentionPrefBundleIDs 0 && killall "$APP_NAME"

echo "Badge notification removed for $APP_NAME"

Enhanced App Badge Management

#!/bin/bash

# Advanced badge notification removal with validation
remove_app_badge() {
    local app_name="$1"
    
    if [[ -z "$app_name" ]]; then
        echo "❌ Error: Application name required"
        return 1
    fi
    
    # Check if application is running
    if pgrep -x "$app_name" > /dev/null; then
        echo "📱 Removing badge notification for $app_name..."
        
        # Remove badge notification
        defaults write com.apple.systempreferences AttentionPrefBundleIDs 0
        
        # Terminate and restart application to apply changes
        if killall "$app_name" 2>/dev/null; then
            echo "✅ Badge notification removed for $app_name"
            echo "ℹ️  Note: Badge will reappear when $app_name is reopened"
        else
            echo "⚠️  Warning: Could not restart $app_name (may not be running)"
        fi
    else
        echo "ℹ️  $app_name is not currently running"
        defaults write com.apple.systempreferences AttentionPrefBundleIDs 0
        echo "✅ Badge notification setting updated for $app_name"
    fi
}

# Usage examples
remove_app_badge "Mail"
remove_app_badge "Messages"
remove_app_badge "Calendar"

Common Applications Badge Removal

#!/bin/bash

# Remove badge notifications for common enterprise applications
COMMON_APPS=("Mail" "Messages" "Calendar" "Reminders" "FaceTime" "App Store" "System Preferences")

echo "🧹 Removing badge notifications for common applications..."

for app in "${COMMON_APPS[@]}"; do
    echo "Processing $app..."
    
    # Set notification preference
    defaults write com.apple.systempreferences AttentionPrefBundleIDs 0
    
    # Kill application if running
    if pgrep -x "$app" > /dev/null; then
        killall "$app" 2>/dev/null
        echo "  ✅ Badge cleared for $app"
    else
        echo "  ⏭️  $app not running, preference updated"
    fi
done

echo "🎉 Badge notification cleanup completed"

Remove All Badge Notifications (Dock-wide)

Basic Dock Badge Clearing

#!/bin/bash

# Remove all badge notifications from the dock
defaults write com.apple.systempreferences AttentionPrefBundleIDs 0 && killall Dock

echo "All badge notifications cleared from dock"

Comprehensive Dock Management

#!/bin/bash

# Advanced dock badge notification management
clear_all_dock_badges() {
    echo "🏗️  Clearing all badge notifications from dock..."
    
    # Backup current dock preferences
    local backup_file="/tmp/dock_backup_$(date +%s).plist"
    defaults export com.apple.dock "$backup_file"
    echo "📋 Dock preferences backed up to: $backup_file"
    
    # Clear badge notifications
    defaults write com.apple.systempreferences AttentionPrefBundleIDs 0
    
    # Get list of running dock applications
    local dock_apps
    dock_apps=$(osascript -e 'tell application "System Events" to get name of every application process whose background only is false')
    
    echo "🔄 Restarting dock to apply changes..."
    killall Dock
    
    # Wait for dock to restart
    sleep 3
    
    echo "✅ All badge notifications cleared from dock"
    echo "ℹ️  Badges will reappear when applications receive new notifications"
    
    return 0
}

# Execute dock badge clearing
clear_all_dock_badges

Enterprise Badge Management Script

#!/bin/bash

# MacFleet Badge Notification Management Tool
# Centralized control of badge notifications across enterprise devices

# Configuration
LOG_FILE="/var/log/macfleet_badges.log"
CONFIG_FILE="/etc/macfleet/badge_policy.conf"
BACKUP_DIR="/var/backups/macfleet/badges"

# Logging function
log_action() {
    echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a "$LOG_FILE"
}

# Create necessary directories
setup_directories() {
    sudo mkdir -p "$(dirname "$LOG_FILE")" 2>/dev/null
    sudo mkdir -p "$BACKUP_DIR" 2>/dev/null
    sudo mkdir -p "$(dirname "$CONFIG_FILE")" 2>/dev/null
}

# Load configuration
load_config() {
    if [[ -f "$CONFIG_FILE" ]]; then
        source "$CONFIG_FILE"
        log_action "Configuration loaded from $CONFIG_FILE"
    else
        # Default configuration
        BADGE_POLICY="disabled"  # Options: enabled, disabled, selective
        ALLOWED_BADGE_APPS=("Calendar" "Reminders")
        BLOCKED_BADGE_APPS=("App Store" "System Preferences")
        AUTO_CLEAR_INTERVAL=3600  # 1 hour
        
        log_action "Using default configuration"
    fi
}

# Backup current badge settings
backup_badge_settings() {
    local backup_file="$BACKUP_DIR/badge_settings_$(date +%Y%m%d_%H%M%S).plist"
    
    defaults export com.apple.systempreferences "$backup_file" 2>/dev/null
    
    if [[ -f "$backup_file" ]]; then
        log_action "Badge settings backed up to: $backup_file"
        echo "$backup_file"
    else
        log_action "Warning: Could not backup badge settings"
        return 1
    fi
}

# Get current badge status
get_badge_status() {
    echo "📊 Current Badge Notification Status:"
    echo "======================================"
    
    # Check system preferences setting
    local attention_pref
    attention_pref=$(defaults read com.apple.systempreferences AttentionPrefBundleIDs 2>/dev/null || echo "not set")
    echo "System AttentionPrefBundleIDs: $attention_pref"
    
    # List applications with potential badges
    echo -e "\n📱 Applications that may show badges:"
    local badge_apps=("Mail" "Messages" "Calendar" "Reminders" "FaceTime" "App Store" "System Preferences" "Contacts")
    
    for app in "${badge_apps[@]}"; do
        if pgrep -x "$app" > /dev/null; then
            echo "  🟢 $app (running)"
        else
            echo "  ⚪ $app (not running)"
        fi
    done
    
    # Check dock processes
    echo -e "\n🏗️  Dock status:"
    if pgrep -x "Dock" > /dev/null; then
        echo "  🟢 Dock is running"
    else
        echo "  🔴 Dock is not running"
    fi
}

# Apply badge policy
apply_badge_policy() {
    log_action "Applying badge policy: $BADGE_POLICY"
    
    case "$BADGE_POLICY" in
        "disabled")
            disable_all_badges
            ;;
        "enabled")
            enable_all_badges
            ;;
        "selective")
            apply_selective_policy
            ;;
        *)
            log_action "Error: Unknown badge policy: $BADGE_POLICY"
            return 1
            ;;
    esac
}

# Disable all badge notifications
disable_all_badges() {
    echo "🚫 Disabling all badge notifications..."
    
    backup_badge_settings
    
    # Set system preference to disable badges
    defaults write com.apple.systempreferences AttentionPrefBundleIDs 0
    
    # Restart dock to apply changes
    killall Dock 2>/dev/null
    
    log_action "All badge notifications disabled"
    echo "✅ All badge notifications have been disabled"
}

# Enable all badge notifications
enable_all_badges() {
    echo "✅ Enabling all badge notifications..."
    
    backup_badge_settings
    
    # Remove the restriction (delete the key)
    defaults delete com.apple.systempreferences AttentionPrefBundleIDs 2>/dev/null
    
    # Restart dock to apply changes
    killall Dock 2>/dev/null
    
    log_action "All badge notifications enabled"
    echo "✅ All badge notifications have been enabled"
}

# Apply selective badge policy
apply_selective_policy() {
    echo "🎯 Applying selective badge policy..."
    
    # For selective policy, we need to manage individual app notifications
    # This requires more complex notification management
    
    for app in "${BLOCKED_BADGE_APPS[@]}"; do
        echo "  🚫 Blocking badges for $app"
        # Kill app to clear current badge
        killall "$app" 2>/dev/null
    done
    
    # Set system preference
    defaults write com.apple.systempreferences AttentionPrefBundleIDs 0
    
    log_action "Selective badge policy applied"
    echo "✅ Selective badge policy has been applied"
}

# Monitor and auto-clear badges
monitor_badges() {
    echo "👁️  Starting badge monitoring (interval: ${AUTO_CLEAR_INTERVAL}s)..."
    
    while true; do
        if [[ "$BADGE_POLICY" == "disabled" ]]; then
            # Clear any badges that may have appeared
            defaults write com.apple.systempreferences AttentionPrefBundleIDs 0
            log_action "Auto-cleared badges during monitoring"
        fi
        
        sleep "$AUTO_CLEAR_INTERVAL"
    done
}

# Generate badge management report
generate_report() {
    local report_file="/tmp/macfleet_badge_report_$(date +%Y%m%d_%H%M%S).txt"
    
    {
        echo "MacFleet Badge Notification Report"
        echo "=================================="
        echo "Generated: $(date)"
        echo "Hostname: $(hostname)"
        echo "Policy: $BADGE_POLICY"
        echo ""
        
        echo "System Configuration:"
        echo "  AttentionPrefBundleIDs: $(defaults read com.apple.systempreferences AttentionPrefBundleIDs 2>/dev/null || echo 'not set')"
        echo ""
        
        echo "Application Status:"
        local apps=("Mail" "Messages" "Calendar" "Reminders" "App Store")
        for app in "${apps[@]}"; do
            if pgrep -x "$app" > /dev/null; then
                echo "  $app: Running"
            else
                echo "  $app: Not running"
            fi
        done
        
        echo ""
        echo "Recent Actions:"
        tail -10 "$LOG_FILE" 2>/dev/null || echo "No recent log entries"
        
    } > "$report_file"
    
    echo "📄 Badge management report generated: $report_file"
    log_action "Report generated: $report_file"
}

# Main function
main() {
    case "${1:-status}" in
        "disable")
            setup_directories
            load_config
            log_action "=== Badge Management: Disable All ==="
            disable_all_badges
            ;;
        "enable")
            setup_directories
            load_config
            log_action "=== Badge Management: Enable All ==="
            enable_all_badges
            ;;
        "policy")
            setup_directories
            load_config
            log_action "=== Badge Management: Apply Policy ==="
            apply_badge_policy
            ;;
        "monitor")
            setup_directories
            load_config
            log_action "=== Badge Management: Start Monitoring ==="
            monitor_badges
            ;;
        "report")
            setup_directories
            load_config
            generate_report
            ;;
        "status"|*)
            setup_directories
            load_config
            get_badge_status
            ;;
    esac
}

# Execute main function with parameters
main "$@"

Badge Notification Management Commands

Quick Reference

TaskCommand
Remove specific app badgedefaults write com.apple.systempreferences AttentionPrefBundleIDs 0 && killall AppName
Clear all dock badgesdefaults write com.apple.systempreferences AttentionPrefBundleIDs 0 && killall Dock
Check current settingdefaults read com.apple.systempreferences AttentionPrefBundleIDs
Reset to defaultdefaults delete com.apple.systempreferences AttentionPrefBundleIDs

Application-Specific Examples

# Common applications
defaults write com.apple.systempreferences AttentionPrefBundleIDs 0 && killall Mail
defaults write com.apple.systempreferences AttentionPrefBundleIDs 0 && killall Messages
defaults write com.apple.systempreferences AttentionPrefBundleIDs 0 && killall "App Store"
defaults write com.apple.systempreferences AttentionPrefBundleIDs 0 && killall Calendar

Troubleshooting

Common Issues

  1. Badges reappear after clearing

    • This is normal behavior; badges return when apps receive new notifications
    • Use monitoring scripts for persistent clearing
  2. Application won't restart

    • Some apps may need manual restart
    • Check if app is set to launch at login
  3. Dock doesn't update

    • Try forcing dock restart: killall Dock && sleep 2 && open /System/Library/CoreServices/Dock.app

Verification Commands

# Check if setting was applied
defaults read com.apple.systempreferences AttentionPrefBundleIDs

# List running applications
ps aux | grep -E "(Mail|Messages|Calendar)" | grep -v grep

# Monitor dock process
ps aux | grep Dock | grep -v grep

Important Notes

  • Temporary effect: Badge notifications will reappear when applications receive new notifications
  • System restart: Settings persist across system restarts
  • User experience: Consider user notification needs before enterprise-wide deployment
  • Application behavior: Some apps may require manual restart to apply changes
  • Testing recommended: Test on individual devices before fleet-wide deployment

Enterprise Deployment

For enterprise deployment, consider:

  1. Policy configuration - Define which applications should show badges
  2. User communication - Inform users about notification changes
  3. Monitoring setup - Implement automated badge clearing if required
  4. Backup procedures - Save original settings before making changes
  5. Rollback plan - Ability to restore original notification behavior

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.