Tutorial

Novas atualizações e melhorias para a Macfleet.

Aviso importante

Os exemplos de código e scripts fornecidos nestes tutoriais são apenas para fins educacionais. A Macfleet não é responsável por quaisquer problemas, danos ou vulnerabilidades de segurança que possam surgir do uso, modificação ou implementação destes exemplos. Sempre revise e teste o código em um ambiente seguro antes de usá-lo em sistemas de produção.

Manage Kernel Extensions on macOS

Monitor and manage kernel extensions across your MacFleet devices using command-line tools. This tutorial covers displaying loaded kexts, loading/unloading extensions, finding specific extensions, and enterprise security monitoring.

Understanding macOS Kernel Extensions

Kernel Extensions (kexts) are drivers that enable the macOS kernel to communicate with hardware devices and system components. Understanding kext management is crucial for:

  • Hardware compatibility - Device drivers and hardware communication
  • System stability - Monitoring potentially problematic extensions
  • Security assessment - Identifying unauthorized or malicious kexts
  • Compliance requirements - Enterprise security and audit trails

Key tools for kext management:

  • kextstat - Display loaded kernel extensions
  • kextload - Load kernel extensions
  • kextunload - Unload kernel extensions
  • kextfind - Find kernel extensions by criteria

Display Loaded Kernel Extensions

List All Loaded Extensions

#!/bin/bash

# Display all currently loaded kernel extensions
kextstat

echo "Kernel extensions list retrieved successfully"

Show Specific Extension Details

#!/bin/bash

# Display details of a specific kernel extension by bundle ID
BUNDLE_ID="${1:-com.apple.kpi.bsd}"

echo "Searching for kernel extension: $BUNDLE_ID"
kextstat | grep "$BUNDLE_ID"

if [[ $? -eq 0 ]]; then
    echo "Extension found and loaded"
else
    echo "Extension not found or not loaded"
fi

List Third-Party Extensions Only

#!/bin/bash

# Display only third-party (non-Apple) kernel extensions
echo "=== Third-Party Kernel Extensions ==="
echo "Device: $(hostname)"
echo "Date: $(date)"
echo "====================================="

echo -e "\n🔍 Non-Apple Kernel Extensions:"
third_party_kexts=$(kextstat | grep -v com.apple)

if [[ -n "$third_party_kexts" ]]; then
    echo "$third_party_kexts"
    echo -e "\n📊 Third-party extension count: $(echo "$third_party_kexts" | wc -l)"
else
    echo "No third-party kernel extensions detected"
fi

Comprehensive Kext Analysis

#!/bin/bash

# Detailed kernel extension analysis
echo "=== MacFleet Kernel Extension Analysis ==="
echo "Device: $(hostname)"
echo "OS Version: $(sw_vers -productVersion)"
echo "Kernel Version: $(uname -r)"
echo "Date: $(date)"
echo "=========================================="

# Total loaded extensions
total_kexts=$(kextstat | tail -n +2 | wc -l)
echo "🔧 Total loaded extensions: $total_kexts"

# Apple vs third-party breakdown
apple_kexts=$(kextstat | grep -c com.apple)
third_party_kexts=$(kextstat | grep -v com.apple | tail -n +2 | wc -l)

echo "🍎 Apple extensions: $apple_kexts"
echo "🔌 Third-party extensions: $third_party_kexts"

# Show third-party extensions if any
if [[ $third_party_kexts -gt 0 ]]; then
    echo -e "\n⚠️  Third-Party Extensions:"
    kextstat | grep -v com.apple | tail -n +2
fi

# Check for potentially suspicious extensions
echo -e "\n🔒 Security Analysis:"
suspicious_patterns=("hack" "crack" "cheat" "bypass" "inject")
for pattern in "${suspicious_patterns[@]}"; do
    suspicious=$(kextstat | grep -i "$pattern")
    if [[ -n "$suspicious" ]]; then
        echo "🚨 Suspicious extension detected: $suspicious"
    fi
done

echo "✅ Security analysis completed"

Load Kernel Extensions

Basic Extension Loading

#!/bin/bash

# Load a kernel extension by path
KEXT_PATH="${1}"

if [[ -z "$KEXT_PATH" ]]; then
    echo "Usage: $0 <path_to_kext>"
    echo "Example: $0 /System/Library/Extensions/FakeSMC.kext"
    exit 1
fi

if [[ ! -d "$KEXT_PATH" ]]; then
    echo "❌ Kernel extension not found: $KEXT_PATH"
    exit 1
fi

echo "Loading kernel extension: $KEXT_PATH"
if sudo kextload "$KEXT_PATH"; then
    echo "✅ Kernel extension loaded successfully"
else
    echo "❌ Failed to load kernel extension"
    exit 1
fi

Safe Extension Loading with Verification

#!/bin/bash

# Safely load kernel extension with verification
load_kext_safely() {
    local kext_path="$1"
    local bundle_id="$2"
    
    if [[ -z "$kext_path" ]]; then
        echo "❌ Kernel extension path required"
        return 1
    fi
    
    # Verify extension exists
    if [[ ! -d "$kext_path" ]]; then
        echo "❌ Kernel extension not found: $kext_path"
        return 1
    fi
    
    # Check if already loaded
    if [[ -n "$bundle_id" ]]; then
        if kextstat | grep -q "$bundle_id"; then
            echo "⚠️  Extension already loaded: $bundle_id"
            return 0
        fi
    fi
    
    # Validate extension
    echo "🔍 Validating kernel extension..."
    if ! kextutil -t "$kext_path" 2>/dev/null; then
        echo "❌ Extension validation failed"
        return 1
    fi
    
    # Load the extension
    echo "📦 Loading kernel extension: $kext_path"
    if sudo kextload "$kext_path"; then
        echo "✅ Kernel extension loaded successfully"
        
        # Verify it's actually loaded
        if [[ -n "$bundle_id" ]]; then
            sleep 1
            if kextstat | grep -q "$bundle_id"; then
                echo "✅ Extension verified as loaded"
            else
                echo "⚠️  Extension load status unclear"
            fi
        fi
        
        return 0
    else
        echo "❌ Failed to load kernel extension"
        return 1
    fi
}

# Example usage
# load_kext_safely "/System/Library/Extensions/FakeSMC.kext" "com.apple.driver.FakeSMC"

Enterprise Extension Loading

#!/bin/bash

# Enterprise kernel extension loading with logging
LOG_FILE="/var/log/macfleet_kext_operations.log"

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

load_enterprise_kext() {
    local kext_path="$1"
    local description="$2"
    
    log_action "=== Kernel Extension Load Operation ==="
    log_action "Device: $(hostname)"
    log_action "User: $(whoami)"
    log_action "Extension: $kext_path"
    log_action "Description: ${description:-No description provided}"
    
    # Pre-load checks
    if [[ ! -d "$kext_path" ]]; then
        log_action "ERROR: Extension not found at path: $kext_path"
        return 1
    fi
    
    # Check current system state
    local pre_count=$(kextstat | tail -n +2 | wc -l)
    log_action "Pre-load extension count: $pre_count"
    
    # Attempt to load
    log_action "Attempting to load extension..."
    if sudo kextload "$kext_path" 2>&1 | tee -a "$LOG_FILE"; then
        local post_count=$(kextstat | tail -n +2 | wc -l)
        log_action "SUCCESS: Extension loaded"
        log_action "Post-load extension count: $post_count"
        
        # Generate load report
        {
            echo "MacFleet Kernel Extension Load Report"
            echo "Time: $(date)"
            echo "Extension: $kext_path"
            echo "Status: SUCCESS"
            echo "Pre-load count: $pre_count"
            echo "Post-load count: $post_count"
        } >> "$LOG_FILE"
        
        return 0
    else
        log_action "ERROR: Failed to load extension"
        return 1
    fi
}

# Usage: load_enterprise_kext "/path/to/extension.kext" "Description"

Unload Kernel Extensions

Basic Extension Unloading

#!/bin/bash

# Unload kernel extension by path
KEXT_PATH="${1}"

if [[ -z "$KEXT_PATH" ]]; then
    echo "Usage: $0 <path_to_kext>"
    echo "Example: $0 /System/Library/Extensions/FakeSMC.kext"
    exit 1
fi

echo "Unloading kernel extension: $KEXT_PATH"
if sudo kextunload "$KEXT_PATH"; then
    echo "✅ Kernel extension unloaded successfully"
else
    echo "❌ Failed to unload kernel extension"
    exit 1
fi

Unload by Bundle ID

#!/bin/bash

# Unload kernel extension by bundle identifier
BUNDLE_ID="${1}"

if [[ -z "$BUNDLE_ID" ]]; then
    echo "Usage: $0 <bundle_id>"
    echo "Example: $0 com.apple.driver.FakeSMC"
    exit 1
fi

# Check if extension is loaded
if ! kextstat | grep -q "$BUNDLE_ID"; then
    echo "⚠️  Extension not currently loaded: $BUNDLE_ID"
    exit 0
fi

echo "Unloading kernel extension: $BUNDLE_ID"
if sudo kextunload -b "$BUNDLE_ID"; then
    echo "✅ Kernel extension unloaded successfully"
    
    # Verify unload
    sleep 1
    if ! kextstat | grep -q "$BUNDLE_ID"; then
        echo "✅ Extension confirmed unloaded"
    else
        echo "⚠️  Extension may still be loaded"
    fi
else
    echo "❌ Failed to unload kernel extension"
    exit 1
fi

Safe Extension Unloading

#!/bin/bash

# Safely unload kernel extensions with dependency checking
unload_kext_safely() {
    local bundle_id="$1"
    local force_unload="${2:-false}"
    
    if [[ -z "$bundle_id" ]]; then
        echo "❌ Bundle ID required"
        return 1
    fi
    
    # Check if extension is loaded
    if ! kextstat | grep -q "$bundle_id"; then
        echo "ℹ️  Extension not loaded: $bundle_id"
        return 0
    fi
    
    # Check for Apple extensions (warn but allow)
    if [[ "$bundle_id" == com.apple.* ]]; then
        echo "⚠️  WARNING: Attempting to unload Apple system extension"
        echo "This may cause system instability"
        
        if [[ "$force_unload" != "true" ]]; then
            echo "❌ Aborting unload of Apple extension (use force_unload=true to override)"
            return 1
        fi
    fi
    
    # Show extension info before unload
    echo "🔍 Extension information:"
    kextstat | grep "$bundle_id"
    
    # Attempt unload
    echo "📤 Unloading extension: $bundle_id"
    if sudo kextunload -b "$bundle_id"; then
        echo "✅ Extension unloaded successfully"
        
        # Verify unload
        sleep 2
        if ! kextstat | grep -q "$bundle_id"; then
            echo "✅ Extension confirmed unloaded"
            return 0
        else
            echo "⚠️  Extension still appears to be loaded"
            return 1
        fi
    else
        echo "❌ Failed to unload extension"
        return 1
    fi
}

# Example usage
# unload_kext_safely "com.third.party.driver"
# unload_kext_safely "com.apple.driver.something" "true"  # Force Apple extension

Find Kernel Extensions

Find by Bundle ID

#!/bin/bash

# Find kernel extensions by bundle ID
BUNDLE_ID="${1}"

if [[ -z "$BUNDLE_ID" ]]; then
    echo "Usage: $0 <bundle_id>"
    echo "Example: $0 com.apple.driver.AppleHDA"
    exit 1
fi

echo "Searching for kernel extension: $BUNDLE_ID"
kextfind -b "$BUNDLE_ID"

# Also check if it's currently loaded
echo -e "\nLoad status:"
if kextstat | grep -q "$BUNDLE_ID"; then
    echo "✅ Extension is currently loaded"
    kextstat | grep "$BUNDLE_ID"
else
    echo "❌ Extension is not currently loaded"
fi

Comprehensive Extension Search

#!/bin/bash

# Comprehensive kernel extension search and analysis
search_kext_comprehensive() {
    local search_term="$1"
    
    if [[ -z "$search_term" ]]; then
        echo "Usage: search_kext_comprehensive <search_term>"
        return 1
    fi
    
    echo "=== Comprehensive Kernel Extension Search ==="
    echo "Search term: $search_term"
    echo "Device: $(hostname)"
    echo "Date: $(date)"
    echo "============================================="
    
    # Search by bundle ID
    echo -e "\n🔍 Searching by bundle ID:"
    local found_by_bundle=$(kextfind -b "*$search_term*" 2>/dev/null)
    if [[ -n "$found_by_bundle" ]]; then
        echo "$found_by_bundle"
    else
        echo "No extensions found matching bundle ID pattern"
    fi
    
    # Search loaded extensions
    echo -e "\n📋 Checking loaded extensions:"
    local loaded_matches=$(kextstat | grep -i "$search_term")
    if [[ -n "$loaded_matches" ]]; then
        echo "Found in loaded extensions:"
        echo "$loaded_matches"
    else
        echo "No loaded extensions match search term"
    fi
    
    # Search filesystem
    echo -e "\n💾 Searching filesystem:"
    echo "System extensions directory:"
    find /System/Library/Extensions -name "*$search_term*" -type d 2>/dev/null | head -10
    
    echo -e "\nLibrary extensions directory:"
    find /Library/Extensions -name "*$search_term*" -type d 2>/dev/null | head -10
    
    echo -e "\n✅ Search completed"
}

# Example usage
# search_kext_comprehensive "bluetooth"
# search_kext_comprehensive "audio"

Find Extensions by Pattern

#!/bin/bash

# Find kernel extensions matching various patterns
echo "=== Kernel Extension Pattern Search ==="

# Audio-related extensions
echo -e "\n🔊 Audio Extensions:"
kextstat | grep -i -E "(audio|sound|hda)"

# Network-related extensions
echo -e "\n🌐 Network Extensions:"
kextstat | grep -i -E "(network|wifi|ethernet|bluetooth)"

# Graphics-related extensions
echo -e "\n🖥️  Graphics Extensions:"
kextstat | grep -i -E "(graphics|display|amd|nvidia|intel)"

# USB-related extensions
echo -e "\n🔌 USB Extensions:"
kextstat | grep -i -E "(usb|port)"

# Security-related extensions
echo -e "\n🔒 Security Extensions:"
kextstat | grep -i -E "(security|firewall|antivirus)"

# Virtualization extensions
echo -e "\n☁️  Virtualization Extensions:"
kextstat | grep -i -E "(vmware|parallels|virtual|hypervisor)"

Enterprise Kernel Extension Monitoring

Security Monitoring Script

#!/bin/bash

# Enterprise kernel extension security monitoring
LOG_FILE="/var/log/macfleet_kext_security.log"
ALERT_FILE="/var/log/macfleet_kext_alerts.log"

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

# Alert function
send_alert() {
    echo "$(date '+%Y-%m-%d %H:%M:%S') - ALERT: $1" | tee -a "$ALERT_FILE"
}

# Security assessment
assess_kext_security() {
    log_security "=== Kernel Extension Security Assessment ==="
    log_security "Device: $(hostname)"
    log_security "OS Version: $(sw_vers -productVersion)"
    
    # Count extensions
    local total_kexts=$(kextstat | tail -n +2 | wc -l)
    local apple_kexts=$(kextstat | grep -c com.apple)
    local third_party=$(kextstat | grep -v com.apple | tail -n +2 | wc -l)
    
    log_security "Total extensions: $total_kexts"
    log_security "Apple extensions: $apple_kexts"
    log_security "Third-party extensions: $third_party"
    
    # Alert on high third-party count
    if [[ $third_party -gt 5 ]]; then
        send_alert "High number of third-party extensions: $third_party"
    fi
    
    # Check for suspicious extensions
    local suspicious_keywords=("hack" "crack" "cheat" "bypass" "inject" "hook" "patch")
    for keyword in "${suspicious_keywords[@]}"; do
        local matches=$(kextstat | grep -i "$keyword")
        if [[ -n "$matches" ]]; then
            send_alert "Suspicious extension detected ($keyword): $matches"
        fi
    done
    
    # Check for unsigned extensions
    echo -e "\n🔍 Checking extension signatures..."
    kextstat | grep -v com.apple | tail -n +2 | while read line; do
        local bundle_id=$(echo "$line" | awk '{print $6}')
        if [[ -n "$bundle_id" ]]; then
            # This is a simplified check - in reality, you'd want more sophisticated signature verification
            log_security "Third-party extension: $bundle_id"
        fi
    done
    
    log_security "Security assessment completed"
}

# Generate security report
generate_security_report() {
    local report_file="/tmp/kext_security_report_$(date +%Y%m%d_%H%M%S).txt"
    
    {
        echo "MacFleet Kernel Extension Security Report"
        echo "Generated: $(date)"
        echo "Device: $(hostname)"
        echo "OS Version: $(sw_vers -productVersion)"
        echo "========================================"
        echo ""
        
        echo "📊 Extension Statistics:"
        echo "Total loaded: $(kextstat | tail -n +2 | wc -l)"
        echo "Apple extensions: $(kextstat | grep -c com.apple)"
        echo "Third-party: $(kextstat | grep -v com.apple | tail -n +2 | wc -l)"
        echo ""
        
        echo "🔍 Third-Party Extensions:"
        kextstat | grep -v com.apple | tail -n +2
        echo ""
        
        echo "🔒 Security Recommendations:"
        local third_party_count=$(kextstat | grep -v com.apple | tail -n +2 | wc -l)
        if [[ $third_party_count -eq 0 ]]; then
            echo "✅ No third-party extensions detected"
        else
            echo "⚠️  Review all third-party extensions for necessity"
            echo "⚠️  Verify digital signatures and sources"
            echo "⚠️  Consider removing unused extensions"
        fi
        
    } > "$report_file"
    
    echo "📋 Security report generated: $report_file"
}

# Main security monitoring
main() {
    assess_kext_security
    generate_security_report
}

# Execute monitoring
main "$@"

Extension Change Monitoring

#!/bin/bash

# Monitor kernel extension changes over time
BASELINE_FILE="/var/lib/macfleet/kext_baseline.txt"
CHANGES_LOG="/var/log/macfleet_kext_changes.log"

# Create directories if needed
sudo mkdir -p "$(dirname "$BASELINE_FILE")"
sudo mkdir -p "$(dirname "$CHANGES_LOG")"

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

# Create or update baseline
create_baseline() {
    echo "📋 Creating kernel extension baseline..."
    kextstat > "$BASELINE_FILE"
    log_change "Baseline created with $(kextstat | tail -n +2 | wc -l) extensions"
}

# Check for changes
check_changes() {
    if [[ ! -f "$BASELINE_FILE" ]]; then
        echo "⚠️  No baseline found, creating one..."
        create_baseline
        return
    fi
    
    local current_file="/tmp/kext_current_$(date +%Y%m%d_%H%M%S).txt"
    kextstat > "$current_file"
    
    # Compare with baseline
    local changes=$(diff "$BASELINE_FILE" "$current_file")
    
    if [[ -n "$changes" ]]; then
        log_change "Kernel extension changes detected:"
        echo "$changes" | sudo tee -a "$CHANGES_LOG"
        
        # Analyze changes
        local added=$(echo "$changes" | grep "^>" | wc -l)
        local removed=$(echo "$changes" | grep "^<" | wc -l)
        
        log_change "Extensions added: $added"
        log_change "Extensions removed: $removed"
        
        echo "🔄 Changes detected - check $CHANGES_LOG for details"
    else
        echo "✅ No changes detected since baseline"
    fi
    
    # Clean up
    rm -f "$current_file"
}

# Usage
case "${1:-check}" in
    "baseline")
        create_baseline
        ;;
    "check")
        check_changes
        ;;
    *)
        echo "Usage: $0 [baseline|check]"
        ;;
esac

Kernel Extension Reference

Common Extension Categories

CategoryBundle ID PatternPurpose
Audiocom.apple.driver.*HDA*Audio hardware drivers
Graphicscom.apple.driver.*Graphics*Display and GPU drivers
Networkcom.apple.driver.*Ethernet*Network interface drivers
USBcom.apple.driver.*USB*USB device support
Storagecom.apple.driver.*Storage*Disk and storage drivers
Bluetoothcom.apple.driver.*Bluetooth*Bluetooth connectivity
Securitycom.apple.security.*Security frameworks

Command Reference

# List all loaded extensions
kextstat

# List with specific columns
kextstat -l

# Find extension by bundle ID
kextfind -b com.apple.driver.AppleHDA

# Load extension
sudo kextload /path/to/extension.kext

# Unload by path
sudo kextunload /path/to/extension.kext

# Unload by bundle ID
sudo kextunload -b com.example.driver

# Test extension without loading
kextutil -t /path/to/extension.kext

# Show extension dependencies
kextutil -d /path/to/extension.kext

Important Security Notes

  • Apple Extensions - Generally safe but unloading may cause instability
  • Third-party Extensions - Require careful security assessment
  • Unsigned Extensions - Potential security risk, audit carefully
  • Administrative Privileges - Loading/unloading requires sudo access
  • System Impact - Extension changes can affect system stability
  • Recovery Mode - May be needed if system becomes unstable

Troubleshooting

Common Issues

Extension Won't Load:

# Check extension validity
kextutil -t /path/to/extension.kext

# Check system logs
log show --predicate 'subsystem == "com.apple.kernel"' --last 1h

Extension Won't Unload:

# Check dependencies
kextutil -d /path/to/extension.kext

# Force unload (dangerous)
sudo kextunload -b bundle.id -f

Permission Denied:

# Ensure admin privileges
sudo -v

# Check System Integrity Protection
csrutil status

Remember to test kernel extension operations on individual devices before deploying across your MacFleet environment, as improper kext management can cause system instability.

Tutorial

Novas atualizações e melhorias para a Macfleet.

Configurando um Runner do GitHub Actions em um Mac Mini (Apple Silicon)

Runner do GitHub Actions

GitHub Actions é uma plataforma poderosa de CI/CD que permite automatizar seus fluxos de trabalho de desenvolvimento de software. Embora o GitHub ofereça runners hospedados, runners auto-hospedados fornecem maior controle e personalização para sua configuração de CI/CD. Este tutorial o guia através da configuração e conexão de um runner auto-hospedado em um Mac mini para executar pipelines do macOS.

Pré-requisitos

Antes de começar, certifique-se de ter:

  • Um Mac mini (registre-se no Macfleet)
  • Um repositório GitHub com direitos de administrador
  • Um gerenciador de pacotes instalado (preferencialmente Homebrew)
  • Git instalado em seu sistema

Passo 1: Criar uma Conta de Usuário Dedicada

Primeiro, crie uma conta de usuário dedicada para o runner do GitHub Actions:

# Criar a conta de usuário 'gh-runner'
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

# Definir a senha para o usuário
sudo dscl . -passwd /Users/gh-runner sua_senha

# Adicionar 'gh-runner' ao grupo 'admin'
sudo dscl . -append /Groups/admin GroupMembership gh-runner

Mude para a nova conta de usuário:

su gh-runner

Passo 2: Instalar Software Necessário

Instale Git e Rosetta 2 (se estiver usando Apple Silicon):

# Instalar Git se ainda não estiver instalado
brew install git

# Instalar Rosetta 2 para Macs Apple Silicon
softwareupdate --install-rosetta

Passo 3: Configurar o Runner do GitHub Actions

  1. Vá para seu repositório GitHub
  2. Navegue para Configurações > Actions > Runners

Runner do GitHub Actions

  1. Clique em "New self-hosted runner" (https://github.com/<username>/<repository>/settings/actions/runners/new)
  2. Selecione macOS como imagem do runner e ARM64 como arquitetura
  3. Siga os comandos fornecidos para baixar e configurar o runner

Runner do GitHub Actions

Crie um arquivo .env no diretório _work do runner:

# arquivo _work/.env
ImageOS=macos15
XCODE_15_DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
  1. Execute o script run.sh em seu diretório do runner para completar a configuração.
  2. Verifique se o runner está ativo e ouvindo por trabalhos no terminal e verifique as configurações do repositório GitHub para a associação do runner e status Idle.

Runner do GitHub Actions

Passo 4: Configurar Sudoers (Opcional)

Se suas ações requerem privilégios de root, configure o arquivo sudoers:

sudo visudo

Adicione a seguinte linha:

gh-runner ALL=(ALL) NOPASSWD: ALL

Passo 5: Usar o Runner em Fluxos de Trabalho

Configure seu fluxo de trabalho do GitHub Actions para usar o runner auto-hospedado:

name: Fluxo de trabalho de exemplo

on:
  workflow_dispatch:

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

O runner está autenticado em seu repositório e rotulado com self-hosted, macOS, e ARM64. Use-o em seus fluxos de trabalho especificando estes rótulos no campo runs-on:

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

Melhores Práticas

  • Mantenha seu software do runner atualizado
  • Monitore regularmente os logs do runner para problemas
  • Use rótulos específicos para diferentes tipos de runners
  • Implemente medidas de segurança adequadas
  • Considere usar múltiplos runners para balanceamento de carga

Solução de Problemas

Problemas comuns e soluções:

  1. Runner não conectando:

    • Verifique conectividade de rede
    • Verifique validade do token GitHub
    • Certifique-se de permissões adequadas
  2. Falhas de build:

    • Verifique instalação do Xcode
    • Verifique dependências necessárias
    • Revise logs do fluxo de trabalho
  3. Problemas de permissão:

    • Verifique permissões do usuário
    • Verifique configuração sudoers
    • Revise permissões do sistema de arquivos

Conclusão

Agora você tem um runner auto-hospedado do GitHub Actions configurado em seu Mac mini. Esta configuração fornece mais controle sobre seu ambiente CI/CD e permite executar fluxos de trabalho específicos do macOS de forma eficiente.

Lembre-se de manter regularmente seu runner e mantê-lo atualizado com os patches de segurança e versões de software mais recentes.

Aplicativo Nativo

Aplicativo nativo do Macfleet

Guia de Instalação do Macfleet

Macfleet é uma solução poderosa de gerenciamento de frota projetada especificamente para ambientes Mac Mini hospedados na nuvem. Como provedor de hospedagem na nuvem Mac Mini, você pode usar o Macfleet para monitorar, gerenciar e otimizar toda sua frota de instâncias Mac virtualizadas.

Este guia de instalação o conduzirá através da configuração do monitoramento do Macfleet em sistemas macOS, Windows e Linux para garantir supervisão abrangente de sua infraestrutura na nuvem.

🍎 macOS

  • Baixe o arquivo .dmg para Mac aqui
  • Clique duas vezes no arquivo .dmg baixado
  • Arraste o aplicativo Macfleet para a pasta Aplicativos
  • Ejete o arquivo .dmg
  • Abra Preferências do Sistema > Segurança e Privacidade
    • Aba Privacidade > Acessibilidade
    • Marque Macfleet para permitir monitoramento
  • Inicie o Macfleet a partir de Aplicativos
  • O rastreamento inicia automaticamente

🪟 Windows

  • Baixe o arquivo .exe para Windows aqui
  • Clique com o botão direito no arquivo .exe > "Executar como administrador"
  • Siga o assistente de instalação
  • Aceite os termos e condições
  • Permita no Windows Defender se solicitado
  • Conceda permissões de monitoramento de aplicativo
  • Inicie o Macfleet a partir do Menu Iniciar
  • O aplicativo começa o rastreamento automaticamente

🐧 Linux

  • Baixe o pacote .deb (Ubuntu/Debian) ou .rpm (CentOS/RHEL) aqui
  • Instale usando seu gerenciador de pacotes
    • Ubuntu/Debian: sudo dpkg -i Macfleet-linux.deb
    • CentOS/RHEL: sudo rpm -ivh Macfleet-linux.rpm
  • Permita permissões de acesso X11 se solicitado
  • Adicione o usuário aos grupos apropriados se necessário
  • Inicie o Macfleet a partir do menu Aplicativos
  • O aplicativo começa o rastreamento automaticamente

Nota: Após a instalação em todos os sistemas, faça login com suas credenciais do Macfleet para sincronizar dados com seu painel de controle.