homebrew-gearbox: The Anti-Electron Automation Engine: Inside hgayan7/gearbox
How a SwiftUI frontend and a Python daemon use a shared SQLite database to bring macOS background tasks out of the dark.

Traditional background tasks suffer from a severe visibility problem. You write a script, schedule it with cron or launchd, and hope for the best. When it fails, it usually dies in the dark. Finding out why requires digging through obscure system logs or manually piping output to text files.
- Gearbox replaces opaque cron jobs with a transparent, native macOS automation manager.
- The system rejects Electron bloat by pairing a lightweight SwiftUI frontend with a Python execution daemon.
- A shared SQLite database acts as the sole communication contract between the UI and the daemon.
- This decoupled architecture ensures background tasks continue running flawlessly even if the user interface crashes.
The Death of the Black Box
Local automation on macOS has historically relied on powerful but opaque system primitives. Tools like cron and launchd execute scripts reliably, but they offer zero visibility into active processes. When a scheduled task fails, developers are forced to dig through obscure system logs or piece together manual text file outputs. Gearbox introduces a native layer of observability to this process. It acts as an X-ray lens for local background tasks, offering live log streaming and status tracking directly from the macOS menu bar.
| Feature | cron / launchd | Gearbox |
|---|---|---|
| Interface | CLI (Configuration files) | Native macOS Menu Bar (SwiftUI) |
| Observability | Manual log digging | Live log streaming & Status tracking |
| Scheduling | Cron syntax only | Cron & Natural Language |
| Architecture | Monolithic system process | Decoupled Swift & Python via SQLite |
The Swift-Python Bridge
Most modern interface wrappers default to Electron, trading system resources for cross-platform ease. Gearbox completely rejects this model. It pairs a lightweight, memory-efficient SwiftUI frontend with a robust Python 3.11 backend. The brilliance of this architecture lies in how these two radically different runtimes communicate. There are no complex local HTTP APIs or fragile inter-process communication sockets. Instead, they use a humble SQLite database as their shared state machine.
The defining architectural choice of Gearbox is its shared database. Instead of building a brittle local HTTP API or a complex socket server to bridge the Python backend and the Swift frontend, the developer chose SQLite as the single source of truth.
Crash-Only Resilience
By utilizing a shared database as the absolute contract, Gearbox achieves a highly resilient, decoupled architecture. The SwiftUI menu bar application functions strictly as a dumb viewer and intent writer. The Python daemon, powered by APScheduler, manages the actual execution queue independently. If the menu bar UI crashes or is forcibly closed by the user, the scheduled automations continue to execute flawlessly in the background.
Bypassing the App Store via Homebrew
Distributing a native macOS application that hard-depends on a specific Python interpreter presents a unique challenge. Apple's App Store guidelines heavily restrict bundled interpreters and background daemons. To bypass these limitations, Gearbox relies on a custom Homebrew tap. The Cask definition handles not only the application binary but also the precise Python environment and the necessary system-level LaunchAgents required for true background persistence.
cask "gearbox" do
version "1.0.7"
sha256 "..."
url "https://github.com/hgayan7/gearbox/releases/download/v#{version}/Gearbox.zip"
name "Gearbox"
desc "Local automation manager for macOS"
homepage "https://github.com/hgayan7/gearbox"
depends_on formula: "python@3.11"
app "Gearbox.app"
binary "Gearbox.app/Contents/MacOS/gearbox"
zap trash: [
"~/.gearbox",
"~/Library/LaunchAgents/com.gearbox.daemon.plist",
"~/Library/LaunchAgents/com.gearbox.task.*.plist"
]
end