Crank

React to macOS events
automate your frustrations away
Download
compatible with macOS 14.0+ (Sonoma and later)

Event data in shell scripts

Shell scripts run in zsh and receive event details as environment variables.
CRANK_EVENT_SOURCE, CRANK_EVENT_KIND, and CRANK_EVENT_TIMESTAMP are always set.
Each trigger adds its own: a USB event sets deviceName, Wi-Fi sets networkName, Calendar sets eventTitle and minutesUntil.

Rate limiting

Set a cooldown period on a rule to avoid triggering it multiple times in a short window.
File system events and battery percentage changes can come in bursts. Without a limit, one blip could run your action ten times before it finishes.

Time window scheduling

Limit a rule to a time window and specific days of the week.
A Bluetooth rule that runs a setup script can be set to only fire on weekday mornings.

Compound conditions

Build AND/OR conditions to control exactly when a rule fires.
Scope a Bluetooth rule to a specific device name, a file watcher to a filename pattern, or a battery rule to a percentage range. The action only runs when all conditions pass.

Rule groups

Rules can be organized into named groups. Group by device, project, or workflow.

Hardware-aware

Triggers that need specific hardware only appear on compatible devices.
Lid and ambient light triggers won't show up on a Mac Pro or Mac mini.

Event log

Every trigger event is recorded with its source, kind, values, and timestamp.
Good for figuring out what your Mac is reacting to, or why a rule did or didn't fire.

Action history

Shell script output, exit codes, and errors are saved per run.
If something triggered but didn't behave as expected, this is where to look.