Raycast lets you control your tools with a few keystrokes and Script Commands makes it possible to execute scripts from anywhere on your desktop. They are a great way to speed up every-day tasks such as converting data, opening bookmarks or triggering dev workflows.
This repository contains sample commands and documentation to write your own ones.
Check out the list of all available Script Commands.
To install new commands, follow these steps:
- Open the Extensions tab in the Raycast preferences
- Select the Script Commands extension
- Click
Add More Directories
- Select the Script Command that you want to install
To get started, download one of the sample commands in this repository or write a custom script.
To write your custom Script Commands, go over the following steps:
- Create a new directory for your commands
- Open the Extensions preferences in Raycast and select Script Commands
- Click
Add More Directories
and select your new directory (If it's empty, we generate a template) - Duplicate the generated template and remove ".template." from the file name
- Write your script
- Press
Reload
in the Script Commands preferences - Run your Script Command from the Raycast root search
Ensure your script is executable with chmod +x <path to script>
and has a shebang at the top.
The following parameters are available to customize your Script Command in Raycast:
Name | Description | Required | App Version |
---|---|---|---|
schemaVersion | Schema version to prepare for future changes in the API. Currently there is only version 1 available. | Yes | 0.29+ |
title | Display name of the Script Command that is shown as title in the root search. | Yes | 0.29+ |
mode | Specifies how the script is executed and how the output is presented. - fullOutput: Command prints entire output on separate view. - compact: Command shows a toast while running in background. - silent: Command closes the Raycast window and runs in background. - inline: Sets the script up to be shown as refreshing dashboard command where the output is displayed inline in the item (make sure to also specify a refreshTime ) |
Yes | 0.29+ |
packageName | Display name of the package that is shown as subtitle in the root search. When not provided, the name will be inferred from the script directory name. | No | 0.29+ |
icon | Icon that is displayed in the root search. Can be an emoji, a file path (relative or full) or a remote URL (only https). Supported formats for images are PNG and JPEG. Please make sure to use small icons, recommended size - 32px. | No | 0.29+ |
currentDirectoryPath | Path from which the script is executed. Default is the path of the script. | No | 0.29+ |
needsConfirmation | Specify true if you would like to show confirmation alert dialog before running the script. Can be helpful with destructive scripts like "Quit All Apps" or "Empty Trash". Default value is false . |
No | 0.30+ |
refreshTime | Specify a refresh interval for inline mode scripts in seconds, minutes, hours or days. Examples: 5s , 1m , 12h , 1d . Script output will be shown inline in dashboard items. Note that the actual times are not accurate and can vary depending on how the OS prioritizes scheduled work. The minimum allowed refresh interval is 5 seconds (use responsibly...), and the maximum allowed number of refreshing inline commands is 10. |
No | 0.31+ |
author | Define an author name to be part of the script commands documentation | No | |
authorURL | Author social media, website, email or anything to help the users to get in touch | No | |
description | A brief description about the script command to be presented in the documentation | No |
You can use the standard output to present messages in Raycast. Depending on the mode
, the standard output of your scripts is differently presented.
In fullOutput
the entire output is presented on a separate view, similar to a terminal. This is handy when your script generates output to consume. In compact
mode the last line of the standard output is shown in the toast. And in silent
mode the last line (if exists) will be shown in overlaying HUD toast after Raycast window is closed.
In inline
mode, the first line of output will be directly shown in the command item and automatically refresh according to the specified refreshTime
. Tip: Set your dashboard items as favorites via the action menu in Raycast
If the script exits with a status code not equal to 0, Raycast interprets it as failed and shows a toast that the script failed to run.
The script is running in a non-login shell to avoid loading additional information from profiles. However, if you need to run your script as login-shell, you can specify an argument after shebang, e.g. #!/bin/bash -l
for bash.
We also append /usr/local/bin
to $PATH
variable so you can use your local shell commands without any additional steps. If this is not enough, you can always extend $PATH
by adding export PATH='/some/extra/path:$PATH'
at the top of your script.
If a script doesn't appear in the commands list, make sure these requirements are met:
- Script file is executable (you can run
file <path to script>
command in terminal to check it) - Filename doesn't contain
.template.
string - All required metadata parameters are provided. See the table above which parameters are required.
- You use either
#
or//
comments for metadata parameters - You have reloaded the scripts, via 1) the "Reload" button in preferences or 2), the "Reload Script Directories" command in root search (v0.33+), or 3) automatically via the activated "Auto Reload" feature in preferences (experimental, v0.33+)
If nothing helps, try to go step by step from a template script command or use one of the examples in this repo.
This is a shared place and we're always looking for new Script Commands or other ways to improve Raycast. If you have anything cool to show, please send us a pull request. If we screwed something up, please report a bug. Join our Slack community to brainstorm ideas with like-minded folks.