Alfred 5.5 is here - Find out what's new

Run Script Action

The Run Script action enables you to run commands directly in macOS. The input can be passed in as argv or you can replace {query} with the script.

It's recommended that you use argv, as you don't have to worry about correctly escaping the inputted query.

Run Script Action Sheet

If you have yet to edit the script, a sensible default script (based on the language and input type you've selected) will be shown in grey, including the escaping options if using {query}. Click the "Save" button to save this default script, or edit it to suit your needs.

You can open the workflow folder from the square button to the left of the cancel button, which allows you to quickly add images or other items relevant to your workflow. (This button is in every object configuration sheet.)

Script Configuration

Select the language you'd like to run the script in, from the available interpreters. The listed runtimes are or have been included with macOS by default, but you're not limited to those entries: by setting the language to External Script and using the proper shebang or calling your runtime from a shell (such as /bin/zsh), any language can be used.

You can run scripts sequentially (subsequent instances of your script will wait until the previous one finishes) or concurrently (a new instance of your script is started every time, even if the previous one hasn't finished).

External Scripts

If you select External Script as the language, you can run a script saved to a file. If you don't specify an absolute path, Alfred will look relative to the workflow's folder. Ensure that you have the script's execute permission set.

Environment Variables

When the script runs, a number of useful environment variables are populated by Alfred.

Latest Blog Post:

Video Tutorial: Using Web Searches and Creating Custom Searches in Alfred

CacheFly Campaign Monitor

"Alfred" is a registered trademark of Running with Crayons Ltd. ©2024 Running with Crayons Ltd. All rights reserved.

Terms & Conditions, Privacy Policy, Cookies.