Automated setup scripts for configuring an Apple Silicon Mac Mini as a home server with native macOS applications.
What this does: Turns a fresh Mac Mini into a configured home server with Plex, BitTorrent, Dropbox sync, and remote access.
Prerequisites (5 minutes):
- Install 1Password CLI:
brew install 1password-cli && op signin
- Generate SSH keys:
ssh-keygen -t ed25519
- Copy
config/config.conf.template
toconfig/config.conf
and set yourSERVER_NAME
- Create these 1Password items: "operator", "TimeMachine", "Plex NAS", "Apple", "OpenSubtitles"
Setup (15-30 minutes):
- On dev Mac:
./prep-airdrop.sh
(creates deployment package) - AirDrop the generated folder to your Mac Mini
- On Mac Mini desktop (not SSH):
cd ~/Downloads/MACMINI-setup && ./first-boot.sh
- Reboot and login as operator for automatic final setup
Result: Fully configured server accessible at your-server-name.local
with web interfaces for all services.
π Need details? See Prerequisites and Environment Variables for complete guidance.
This project provides a complete automation framework for setting up an Apple Silicon Mac Mini server that functions as:
- Native application host (Plex Media Server, web services, system utilities)
- Central home server with minimal maintenance requirements
- Stable, secure, and recoverable system
- Complete BitTorrent Automation: New
transmission-setup.sh
provides comprehensive GUI automation- ~95% automation coverage using only verified plist keys from actual configuration
- Magnet link handling automated via Launch Services integration
- Media pipeline integration with download paths and completion scripts
- RPC web interface with authentication and remote access
- LaunchAgent auto-start for seamless operator experience
- Quality Standards Maintained: Zero shellcheck compliance throughout development
- Documentation Updates: Reduced manual setup tasks from 3 to 2 items
- Research Documentation: Catalogued remaining 10% of GUI settings for future development
- Real-time + End Summary: All errors and warnings display immediately during setup, plus consolidated review at completion
- Preserves existing immediate feedback during fast-scrolling operations
- Shows organized summary when setup completes and user attention returns
- Context tracking shows which setup section each issue occurred in
- Consistent Across All Scripts: Unified error handling across the entire setup process
- prep-airdrop.sh: Missing files, SSH keys, WiFi detection, credential issues
- first-boot.sh: System setup, package installation, service configuration
- plex-setup.sh: Plex installation, SMB mounting, migration processes
- rclone-setup.sh: Dropbox sync configuration and testing
- transmission-setup.sh: BitTorrent client configuration and GUI automation
- Better Troubleshooting: Clear distinction between expected warnings vs critical errors
- Expected warnings (optional components): SSH private keys, WiFi detection
- Critical errors (setup blockers): Missing credentials, system failures
- Section context helps pinpoint exactly where issues occurred
- Per-user LaunchAgent approach: Replaced system-level LaunchDaemon with user-specific mounting
- Each user gets private mount in
~/.local/mnt/MOUNT_POINT
- LaunchAgents activate on user login, no root permissions needed
- Same SMB credentials work for both admin and operator users
- Eliminates SIP restrictions and permission issues
- Each user gets private mount in
- Enhanced Security and UX: Comprehensive improvements for production use
- Password masking in logs prevents credential exposure
- Automatic firewall configuration for Plex Media Server
- Network volume permissions pre-granted via tccutil
- Application quarantine removal for seamless operation
- Restored Migration Features: Full SSH-based remote migration capability
- Automatic Plex server discovery on network
- Remote configuration transfer with rsync/scp fallback
- Migration size estimation and progress reporting
- Production-Ready Reliability: Robust error handling and fallback mechanisms
- Keychain-Based Credential Management: Secure credential storage and transfer via macOS Keychain Services (see Credential Management)
- 1Password Integration: Automated credential retrieval from 1Password during setup preparation
- Intuitive Confirmations: Sensible defaults for all prompts
- Separation of Concerns: Base OS setup separate from native application deployment
- Automation First: Minimal human intervention throughout lifecycle
- Idempotency: Scripts can be run multiple times safely
- Security: Hardening and isolation best practices
- Documentation: Clear runbooks for all procedures
The setup process consists of two main phases:
-
Base System Setup (
prep-airdrop.sh
+first-boot.sh
)- System configuration and hardening
- User account management
- SSH access and security
- Package installation (Homebrew)
-
Application Setup (separate scripts in
app-setup/
)- Native macOS application installation and configuration
- Shared configuration directory setup
- LaunchAgent auto-start configuration
- Apple Silicon Mac Mini with fresh macOS installation
- Development Mac with:
- 1Password CLI installed and authenticated (
brew install 1password-cli && op signin
) - SSH keys generated (
~/.ssh/id_ed25519
and~/.ssh/id_ed25519.pub
) - Required 1Password vault items: operator, TimeMachine, Plex NAS, Apple ID, OpenSubtitles
- Core tools:
jq
,openssl
(pre-installed on macOS) - Valid configuration: Copy
config/config.conf.template
toconfig/config.conf
and customize
- 1Password CLI installed and authenticated (
π See Prerequisites Guide for complete setup requirements and validation commands
Compatibility Note: This automation is designed and tested for macOS 15.x on Apple Silicon. It may work on earlier macOS versions or Intel-based Macs, but compatibility is not guaranteed and has not been tested.
-
Prepare deployment package on your development Mac:
./prep-airdrop.sh
This comprehensive script:
- Retrieves credentials from 1Password and transfers them securely via external keychain
- Creates hardware fingerprint validation to prevent wrong-machine execution
- Configures WiFi credentials (offers Migration Assistant or script-based options)
- Generates deployment manifest for package validation
- Processes all configuration files with environment-specific substitutions
-
Transfer to Mac Mini via AirDrop (entire setup folder)
You can use airdrop-cli (requires Xcode) to AirDrop files from the command line! Install: (
brew install --HEAD vldmrkl/formulae/airdrop-cli
) -
Run system provisioning on Mac Mini (requires local desktop session):
cd ~/Downloads/MACMINI-setup # default name ./first-boot.sh
Critical: Must be run from the Mac Mini's local desktop session (Terminal.app) - CANNOT run via SSH. The script performs comprehensive system provisioning including user account creation, credential import, FileVault management, and configuration of 15+ system modules.
This script performs:
- Hardware fingerprint validation and FileVault compatibility checks
- Operator user account creation with automatic login configuration
- SSH key deployment and credential import from external keychain
- Multi-phase system configuration via specialized modules
- Comprehensive error collection and end-of-run validation
-
Complete operator setup after reboot (see Operator Setup)
- Prerequisites Guide - Complete setup requirements and validation
- Environment Variables - Comprehensive customization reference
- AirDrop Prep Instructions - Preparing the setup package
- First Boot Instructions - Running the initial setup
- Operator Setup - Post-reboot configuration
- Configuration Reference - Customizing setup parameters
.
βββ README.md # This file
βββ prep-airdrop.sh # Setup package preparation (primary entry point)
βββ app-setup/ # Application setup scripts
β βββ templates/ # Runtime script templates
β β βββ mount-nas-media.sh # SMB mount script template
β β βββ start-plex.sh # Plex startup wrapper template
β β βββ start-rclone.sh # rclone sync script template
β β βββ transmission-done.sh # Transmission completion script
β β βββ transmission-done-template.sh # Transmission completion template
β βββ plex-setup.sh # Plex Media Server setup
β βββ rclone-setup.sh # Dropbox sync setup
β βββ transmission-setup.sh # BitTorrent client with GUI automation
β βββ run-app-setup.sh # Orchestrator for all applications
βββ scripts/ # Setup and deployment scripts
β βββ airdrop/ # AirDrop preparation scripts
β β βββ rclone-airdrop-prep.sh # Dropbox setup for AirDrop
β βββ server/ # Server setup scripts
β βββ first-boot.sh # Main setup script (requires GUI session)
β βββ setup-remote-desktop.sh # Remote Desktop configuration (requires GUI session)
β βββ operator-first-login.sh # Operator account customization (automatic via LaunchAgent)
βββ config/ # Configuration files
β βββ config.conf.template # Configuration template
β βββ config.conf # Active configuration file
β βββ formulae.txt # Homebrew formulae list
β βββ casks.txt # Homebrew casks list
β βββ logrotate.conf # Log rotation configuration
β βββ com.googlecode.iterm2.plist # iTerm2 profile settings
β βββ Orangebrew.terminal # Terminal.app profile
βββ docs/ # Documentation
βββ setup/ # Setup documentation
β βββ prep-airdrop.md
β βββ first-boot.md
βββ apps/ # App-specific docs
βββ operator.md
βββ configuration.md
The system uses config/config.conf
for customization:
SERVER_NAME="YOUR_SERVER_NAME"
OPERATOR_USERNAME="operator"
ONEPASSWORD_VAULT="personal"
ONEPASSWORD_OPERATOR_ITEM="server operator"
ONEPASSWORD_TIMEMACHINE_ITEM="TimeMachine"
ONEPASSWORD_APPLEID_ITEM="Apple"
MONITORING_EMAIL="your-email@example.com"
This project uses native macOS applications with direct SMB mounting:
- Optimal performance - Direct access to macOS hardware acceleration and native mount handling
- Shared configuration - Multi-user access via
/Users/Shared/
directories - LaunchAgent integration - Applications start automatically with operator login
- Direct SMB mounting - Reliable mount process without complex autofs dependencies
- Administrator-centric setup - Complete configuration by admin, consumption by operator
Key improvements eliminate previous autofs reliability issues and provide robust, debuggable mounting.
- SSH key-based authentication with password fallback disabled
- TouchID sudo access configured during setup for local administration
- Separate operator account for day-to-day use
- Automatic login configured for operator account
- Firewall configuration with SSH allowlist
- Auto-restart on power failure
"GUI session required" error: Setup scripts require local desktop access, not SSH.
- Run
first-boot.sh
andsetup-remote-desktop.sh
from the Mac Mini's desktop (Terminal.app) - Check session:
launchctl managername
should returnAqua
(notBackground
) - Cannot run via SSH - requires direct access for System Settings and AppleScript dialogs
SSH access denied: Verify SSH keys were copied correctly and SSH service is enabled.
TouchID not working: TouchID sudo is configured during first-boot setup. Note: TouchID cannot coexist with automatic login, so the operator account cannot use TouchID.
Homebrew not found: Source shell environment or restart Terminal session.
1Password items not found: Verify vault name and item titles match configuration.
Application not starting: Check LaunchAgent status with launchctl list | grep <app>
. Verify shared configuration directory permissions.
Error Collection System: All setup scripts now provide both immediate error feedback and end-of-run summaries:
====== SETUP SUMMARY ======
Setup completed, but 1 error and 2 warnings occurred:
ERRORS:
β Installing Homebrew Packages: Formula installation failed: some-package
WARNINGS:
β οΈ Copying SSH Keys: SSH private key not found at ~/.ssh/id_ed25519
β οΈ WiFi Network Configuration: Could not detect current WiFi network
Review the full log for details: ~/.local/state/macmini-setup.log
Log Files: Setup logs are stored in ~/.local/state/MACMINI-setup.log
with automatic rotation. (Default name)
- prep-airdrop.sh: Console output during preparation (no separate log file)
- first-boot.sh:
~/.local/state/macmini-setup.log
- plex-setup.sh:
~/.local/state/macmini-apps.log
- rclone-setup.sh:
~/.local/state/macmini-apps.log
- transmission-setup.sh:
~/.local/state/macmini-apps.log
When modifying scripts:
- Maintain idempotency - scripts should handle re-runs gracefully
- Add comprehensive logging via the
log()
andshow_log()
functions - Use error collection system:
collect_error()
for critical failures that may block setupcollect_warning()
for non-critical issues (missing optional components)set_section()
to provide context for error trackingcheck_success()
for automatic error handling
- Update documentation for any configuration changes
- MIT; see LICENSE