There is a Behringer FCB1010 under a lot of desks, bought for a guitar rig that no longer exists. This is about 1,200 lines of Swift that turn it into ten more keys for your Mac, and the reasoning behind it is better than the trick.
The whole interface is one flag. Run fcbnerd -f text, stomp a switch, and it prints the message with the pattern you’d use to bind it:
16:30:41.115 cc channel=1 controller=20 value=127 bind=1:20:127 [USB MIDI Interface]
Then fcbnerd --bind '1:20:127=open ~/Downloads' and that switch opens the folder. Everything after the first = is the command, so it can contain colons and equals signs of its own; bind as many as you like, and every pattern that matches a message fires. Any number can be *, which is how you bind an expression pedal: --bind '1:30:*=osascript -e "set volume output volume $((MIDI_VALUE * 100 / 127))"' puts the system volume under your foot.
The argument for making this a command-line tool rather than an app is the part worth reading. Anything that presses keys or runs scripts on your behalf needs permissions a sandboxed app can’t have, and everyone wants a different set of actions anyway. So fcbnerd only reads MIDI, which needs no permission at all, and hands the doing to your shell — or to Hammerspoon or Keyboard Maestro, which already have the access. It’s a smaller tool that asks for nothing, instead of a bigger one that asks for everything.
It follows hotplug, so unplugging the interface mid-set and plugging it back in just emits disconnected and connected lines. Status goes to stderr and events to stdout, each line flushed as it’s written, so a pipe sees them immediately. Pedal sweeps — dozens of values a second — are specially handled: for a binding with a wildcard value, only one copy runs at a time per control, and fcbnerd keeps the newest value and runs it next, so the shell count stays sane and the sequence still ends on where the pedal actually stopped. A command still running after five seconds gets a note on stderr. Quitting sends SIGTERM to anything still going.
Best of all is fcbnerd simulate, which publishes a virtual MIDI source that loops synthetic presses, a pedal sweep and a sysex message, so you can build and test something against it with no pedal plugged in at all.
Nothing in it is FCB1010-specific — any CoreMIDI source works. macOS 13+, MIT, on Homebrew, though Homebrew 7 wants brew trust --tap jamesryanatx/tap before it will load a third-party tap. The README’s own warning is worth repeating: every matching message starts a shell, so keep broad patterns like *:*:127 away from a noisy device.