Feature Free

Shell Scripts, AppleScript and Apple Shortcuts on a Key

Shell scripts, AppleScript and Apple Shortcuts on a key, with your selection passed in.

macOS 12+ · Apple Silicon & Intel · 33 MB

The Sort a list shortcut beside Apple Notes: a Run shell script step with echo $SUPER_SELECTION piped to sort, saved as sorted, a Paste text step with the sorted token, both checked, a Done capsule, and the note Launch attendees holding four names in alphabetical order.

At a glance

  • For what the interface doesn't expose. A git command, a transform of the selection, a setting with no menu item. Most shortcuts never need one.

  • Your selection comes along. The selected text, the clipboard and every value saved earlier arrive as SUPER_ variables, and what the script prints can be pasted back.

  • Scoped like any shortcut. Super key + D runs the deploy script in the terminal and the formatter in your editor.

  • One step among others. Open the app, run the script, paste its output where the cursor is.

Run shell script

Choose zsh, bash or sh and write the script in the step. Save output as keeps what it printed for the steps after: sort the selected lines with sort, then paste them back.

A Run shell script step uses zsh to count words from SUPER_SELECTION. Save output as is set to words.

Run AppleScript

Same shape, AppleScript instead of a shell. Save result as keeps the script’s last value. A script that drives another app asks for its Automation permission once.

A Run AppleScript step tells Music to play the next track, then saves its name as track. A Music receipt shows the next track, Open windows, playing.

Run Apple Shortcut

Pick any shortcut installed in Apple’s Shortcuts app. The step runs it, waits, and can hand it text with your values filled in.

The Run Apple Shortcut step with its installed-shortcuts picker open and Toggle Vehicle Motion Cues chosen. Nothing is sent in and no output is saved.

How it works

How to run a shell script with a keyboard shortcut on Mac

  1. Start blank and add Run shell script

    Click New Shortcut, choose Start blank, pick the key, then Add a step and choose Run shell script.

  2. Write or paste the script

    Choose zsh, bash or sh. $SUPER_SELECTION is the selected text, $SUPER_CLIPBOARD the clipboard.

  3. Keep the output

    Set Save output as to a name, and a later step can paste it.

Free on every plan.

Download for macOS →

Frequently asked questions

How do I run a shell script with a keyboard shortcut on Mac?

The built-in route is Automator or the Shortcuts app: a Run Shell Script action inside a Quick Action, given a keyboard shortcut in System Settings, with no clean way to pass the selection in. In Super Shortcuts, Run shell script is a step: pick the key, choose the shell, write the script, and the clipboard, selection and saved values are there as environment variables.

What does the script get, and what can it give back?

The script runs from your home folder with no login or dotfiles, with /opt/homebrew/bin and /usr/local/bin on its path. $SUPER_CLIPBOARD and $SUPER_SELECTION are set when the script names them, and one $SUPER_NAME per value saved earlier. Send it text feeds a value to standard input. Save output as keeps what the script prints, up to 1 MB, for the steps after it.

What if the script hangs or fails?

The step fails when the script exits non-zero, with its error output as the message, or runs past Give up after, 30 seconds unless you change it. Escape stops it. A process you mean to leave running must send its output elsewhere, or the step waits for it.

Can I trigger a Shortcuts-app shortcut with a key?

Yes. Run Apple Shortcut searches the shortcuts installed on your Mac, runs the one you pick and waits for it to finish. More options can send it text, values included. It remembers the shortcut's identity, so renaming it later doesn't break the step.

Do I need scripts at all?

Usually not. Menu items, buttons, keys, text, apps, websites and windows are all plain steps. Scripts are for what the app's interface doesn't expose: a git command, a transform of the clipboard, a system setting with no menu item.

Try it on your own Mac.

Free on every plan. Your shortcuts run on your Mac.

macOS 12+ · Apple Silicon & Intel · 33 MB

Not ready yet? The occasional update, no spam.

Your download is starting.

  1. 1
    Open the file and drag Super Shortcuts to Applications.
  2. 2
    Launch it and click Open if macOS asks.
  3. 3
    Turn on Accessibility when it asks. That's how it presses keys and clicks menus for you.

Didn't start? Download again