Mac hosting guide

Run macOS Shortcuts Remotely from the Command Line

Run `shortcuts run "Name"` from a script, with -i for file input and -o for file output. Test each shortcut's exit code and output size once, then schedule it as a LaunchAgent.

Figment editorial teamPublished Updated Facts checked November 10, 2026

Figment Mac plans

US East. Pay before use. Hourly and daily too.

Intel Mac VM4 shared vCPUs, 4GB RAM, 80GB SSD$25per monthApple Silicon Mac VM4 shared vCPUs, 4GB RAM, 65GB SSD$39per monthDedicated M4 Pro12-core CPU, 24GB RAM, 512GB SSD$199per month

Minimum first purchase: $25 of account credit, used for your rental.

Run a shortcut from a script with shortcuts run "Name", pass files with -i and collect output with -o, check the exit code and output size once, then schedule it as a LaunchAgent in a logged-in user session. Exit code 0 means success and 1 means an action in the shortcut failed.

Shortcuts can reach work that shell scripts cannot touch directly: PDF export, image processing through system frameworks, URL-scheme calls and cross-app automation. Apple's shortcuts tool makes any of them callable from a script, a CI step or a launchd job.

Which shortcuts commands do I need?

Apple documents the tool in Run shortcuts from the command line. These are the operations that matter for automation:

CommandPurpose
shortcuts run "Name"Execute a shortcut by name
shortcuts run "Name" -i /path/to/filePass one or more file paths as input
shortcuts run "Name" -o /path/to/outputWrite output to a file
shortcuts run "Name" --output-type public.pdfPin the output format with a UTI
shortcuts listList installed shortcuts
shortcuts list --foldersList shortcut folders
shortcuts list -f FolderNameList shortcuts in a folder
shortcuts view "Name"Open the shortcut in the editor
shortcuts sign --mode people-who-know-me --input in.shortcut --output out.shortcutSign a shortcut for sharing

Piping data into shortcuts run treats it as text input. Use -i when the shortcut should receive file references. Run shortcuts --help on your macOS version to confirm the current flags.

What should I decide about each shortcut before automating it?

The common failure is assuming a shortcut handles inputs and errors the way it does when a person taps Run. Fill this in once per shortcut you plan to schedule:

FieldYour shortcut's value
Shortcut nameExact name as shown in Shortcuts.app
Input typeFile path, text or none
Input formatFor example .jpg, .txt, or no input
Output typeFile, stdout text or none
Output formatFor example public.pdf, public.plain-text
Minimum output sizeBytes or character count you consider valid
Side effectsFiles written, URLs opened, emails sent
Needs user sessionYes for UI-touching actions, otherwise no

The last row matters most. Remote desktop gives you a logged-in session, so UI-touching actions work interactively. A launchd daemon at system level is headless, so schedule UI-touching shortcuts as LaunchAgents that run in the user session, not as LaunchDaemons.

How do I test a shortcut's exit status and output?

Run this once before wiring a shortcut into launchd or CI. It checks the exit code and the output size against your contract.

#!/usr/bin/env bash
# test-shortcut.sh — verify a shortcut's input/output contract
# Usage: ./test-shortcut.sh "My Shortcut" /path/to/input /tmp/out.pdf 1000
set -euo pipefail

SHORTCUT="${1:?name required}"
INPUT="${2:-}"
OUTPUT="${3:-}"
MIN_BYTES="${4:-1000}"
LOG=$(mktemp -t shortcut-test.XXXXXX)

echo "Testing: $SHORTCUT" | tee "$LOG"
CMD=(shortcuts run "$SHORTCUT")
[[ -n "$INPUT"  ]] && CMD+=(-i "$INPUT")
[[ -n "$OUTPUT" ]] && CMD+=(-o "$OUTPUT")

if ! "${CMD[@]}" >>"$LOG" 2>&1; then
  echo "FAIL: shortcuts run exited non-zero. See $LOG and Console.app." >&2
  exit 1
fi

if [[ -n "$OUTPUT" ]]; then
  [[ -f "$OUTPUT" ]] || { echo "FAIL: expected $OUTPUT not created" >&2; exit 1; }
  BYTES=$(wc -c < "$OUTPUT" | tr -d ' ')
  if (( BYTES < MIN_BYTES )); then
    echo "FAIL: output $BYTES bytes, expected >= $MIN_BYTES" >&2
    exit 1
  fi
  echo "PASS: $OUTPUT ($BYTES bytes)"
else
  echo "PASS: no output file expected"
fi

This is an example, not a benchmark. Run it on your own input and set MIN_BYTES to what "clearly not empty" means for the shortcut.

How do I schedule a shortcut with launchd?

When the contract test passes, put the plist at ~/Library/LaunchAgents/com.example.nightly-shortcut.plist so it runs in your user session:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key><string>com.example.nightly-shortcut</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/bin/shortcuts</string>
    <string>run</string>
    <string>My Shortcut Name</string>
    <string>-i</string><string>/Users/agent/inputs/source.jpg</string>
    <string>-o</string><string>/Users/agent/outputs/result.pdf</string>
  </array>
  <key>StartCalendarInterval</key>
  <dict>
    <key>Hour</key><integer>6</integer>
    <key>Minute</key><integer>30</integer>
  </dict>
  <key>StandardOutPath</key><string>/Users/agent/Library/Logs/nightly-shortcut.log</string>
  <key>StandardErrorPath</key><string>/Users/agent/Library/Logs/nightly-shortcut-err.log</string>
</dict>
</plist>

Load it with launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.example.nightly-shortcut.plist. Each <string> in ProgramArguments is one argv entry, so a shortcut name with spaces needs no shell escaping. See Apple's Creating Launch Daemons and Agents. Confirm the binary path with which shortcuts before pinning /usr/bin/shortcuts.

What do I do when a scheduled shortcut fails?

SymptomLikely causeFix
Exit 1, no outputA shortcut action erroredOpen Console.app, filter shortcuts, find the action error
Exit 1, "not found"Name mismatch or shortcut removedRun shortcuts list and match the exact name
Exit 0, no output fileShortcut has no save-file actionAdd "Save File", or drop -o from the contract
Output exists but emptyAction produced no dataRe-run with the real input; check the shortcut's expected input UTI
Works interactively, fails under launchdAction needs the user sessionUse a LaunchAgent, not a LaunchDaemon

For a specific action failure, run the shortcut once from a terminal in a remote desktop session with Console.app open. The system log shows action-level detail that the CLI exit code does not.

How do I move shortcuts to a new Mac?

Export each shortcut from Shortcuts.app (File, then Export, or shortcuts sign for a distributable file), import it on the new Mac, re-run the contract test with the same inputs, then load the plist.

Does a Shortcuts run need an Apple silicon Mac?

shortcuts run executes locally on the Mac, so any plan runs it. The Intel Mac VM ($25 a month, $2 a day, macOS Sequoia) covers standard actions such as text handling, file transformation, PDF export and URL-scheme calls. Choose the Apple Silicon Mac VM ($39 a month, $6 a day) if an action needs Apple silicon, the shortcut calls an app that ships only for Apple silicon, or you need Xcode 26.4 or later (Apple's porting guidance). VM vCPUs are shared, so watch top before adding concurrent jobs. See Figment Mac Hosting.

Related guides:

Which Figment Mac fits this work?

Intel Mac VM from $25 a month, Apple Silicon Mac VM from $39, or a Dedicated M4 Pro for $199. Hourly and daily plans too. You pay before use, starting with at least $25 of account credit.

Choose a Mac plan