How grahampugh/erase-install works
Project type and purpose
• This is a command-line tool and packaging pipeline (a shell-script-based macOS “self-destruct” installer) rather than a web app or microservice.
• Its purpose is to orchestrate macOS installer downloads (via mist-cli or softwareupdate), run Apple’s startosinstall with erase/upgrade flags, and optionally present dialogs (via swiftDialog). It also provides a .pkg build in pkg/erase-install for mass deployment.
File structure
• Top-level scripts:
• erase-install.sh (main entrypoint)
• erase-install-launcher.sh / erase-install-install-scripts (helpers and examples)
• set-credentials.sh (credentials helper)
• Packaging directory: pkg/erase-install/
• build-info.plist (metadata)
• scripts/postinstall (invokes the main script)
• Configuration/build: Makefile, .prettierrc.yaml, .gitignore
• CI/templates: .github (funding, issue templates)
README for additional insights
• Workflow:
a. Download installer app from Apple (mist-cli or softwareupdate)
b. Invoke startosinstall with --eraseinstall or --reinstall flags
c. Optionally present user dialogs via swiftDialog
d. Support integration with Jamf Pro or other MDMs
• External dependencies and minimum OS versions are key architectural constraints.
Main components
a. CLI layer (shell scripts)
• erase-install.sh as orchestrator
• set-credentials.sh as submodule
b. Build/Packaging pipeline
• pkg/erase-install and postinstall script
• Makefile-driven build steps
c. External tools/services
• mist-cli (download agent)
• softwareupdate (native download)
• swiftDialog (UI)
• startosinstall (OS installer binary)
• Apple Software Update servers
• Optional MDM integration (Jamf Pro)
d. Outputs
• macOS Installer.app
• Completed macOS install/erase
Relationships and interactions
• erase-install.sh → invokes either mist-cli or softwareupdate → downloads Installer.app
• erase-install.sh → (if enabled) calls swiftDialog → displays progress/UI → collects user input
• erase-install.sh → calls startosinstall with chosen flags → triggers OS reinstallation
• Packaging pipeline: Makefile → builds .pkg in pkg/erase-install → copies scripts and metadata → outputs installer package for MDM
• Management tool (Jamf Pro) → deploys the .pkg to clients → postinstall script triggers the above steps on target machines
Architectural patterns and design principles
• Modular scripting: separate concerns via helper scripts (set-credentials, launcher)
• Adapter pattern: wrapping native binaries (startosinstall, softwareupdate) behind a unified CLI interface
• CI/CD pipeline for packaging: using Makefile and pkg folder rather than manual packaging
• Externalization of UI: swiftDialog used only when available, fallback to CLI where needed
Elements
• erase-install.sh (orchestrator)
• set-credentials.sh
• pkg/erase-install (packaging component)
• External tools: mist-cli, softwareupdate, swiftDialog, startosinstall
• Apple Software Update servers
• MDM/Jamf Pro server
• Script calls
• Downloads (to local machine)
• Data flow (installer artifact)
• Deployment (MDM → client)
• External binaries in another
• Servers/external services in a third
• Build/pipeline components in a fourth