I want to run a Shortcut from the command line and include Unicode text as a part of the command. I want to do something like: shortcuts run "My Notification Shortcut" "My Text Input"

macOS Notification Dialog

According to the Shortcuts Docs:

Running shortcuts from the command line is no different from running shortcuts in the Shortcuts app—you can pass documents, images, text, and more.

shortcuts -h:
shortcuts run <shortcut-name-or-identifier> [--input-path <input-path> ...] [--output-path <output-path>] [--output-type <output-type>]

This seems to imply that the text must be included as a file. This works:

shortcuts run "Test" -i "/Users/Dave/My Text.txt"

and I want to do this:

shortcuts run "Test" "My Text Input"

Having to save the text to a file seems like an unnecessary step.


Is it possible to pass a text object as a command line arg directly to a Shortcut?


2 Answers 2


Looks like it's possible after all using the bash operator <<<. This shell command works as intended:

shortcuts run "Test Alert" <<< "My Text Input"

Sample Notification with passed text

"man bash"

Here Strings
A variant of here documents, the format is:


The word is expanded and supplied to the command on its standard input.

Update 1: per @Martin R.'s comment above, the following construction also works.

echo "My Text Input" | shortcuts run "Test Alert"


According the the shortcuts man page (man shortcuts) input to be passed must be a file or set of files:

An input file (or set of files) to be processed by the shortcut. Wildcards accepted.

Unfortunately, you cannot pass a text object (a variable, for example) as an argument to the shortcuts command. It has to be a file.

  • 1
    Weird (but not overly so) that the man page and the docs don't match. Thanks for taking the time.
    – DaveL17
    Commented Feb 16, 2023 at 4:02
  • 1
    Unaccepted answer because it turns out that it is possible.
    – DaveL17
    Commented Feb 16, 2023 at 15:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .