Sub topic 13
Sharing shortcuts and reviewing permissions
This chapter assumes you can build a multi-step shortcut, use variables and Shortcut Input, and run a shortcut from the menu bar or Terminal. Here you will learn how to share a shortcut, what a recipient sees when they import it, and how to review and limit what a shortcut can do before you hand it to anyone.
Why sharing needs care
A shortcut is a small program. It can read files, send messages, call web services and run shell scripts. When you share one, the recipient runs your steps on their Mac, with their files and their accounts. Two habits follow from that:
- As a sender, remove anything personal and anything the shortcut does not need.
- As a recipient, read a shortcut before you add it, the same way you would read a script someone emailed you.
macOS helps with both. Shortcuts asks for permission the first time a shortcut touches sensitive data, and it blocks some actions until you allow them.
Ways to share a shortcut
You can share from the shortcut editor or from the library. The exact menu labels vary a little between macOS versions, so look for the Share button (a square with an arrow) in the editor toolbar, or Control-click a shortcut in the library and choose Share.
| Method | What the recipient gets | Typical use |
|---|---|---|
| Messages, Mail or AirDrop | A link or a file that opens in their Shortcuts app | Sending to a person you know |
| Copy iCloud Link | A link to a copy hosted by Apple | Posting in a chat, wiki or web page |
| Export File | A `.shortcut` file | Backups, version control, or sending by any channel |
iCloud links and file exports
An iCloud link points to a snapshot of the shortcut at the moment you created it. If you edit the shortcut later, the old link still gives the old version. Create a new link to share the update. You can also stop sharing an old link from the Shortcuts sharing options, depending on your macOS version.
An exported file is a standalone copy. You can attach it to an email, keep it in a Git repository or store it with your documents. Newer macOS versions may offer to export a signed file, which is tied to your Apple Account. The recipient's Mac can then verify who created it. Shortcuts from the Mac, iPhone and iPad all use the same format, so a shortcut built on a Mac can run on an iPhone if the actions it uses exist there.
Some actions exist only on macOS. The Run Shell Script action is the main example. If you share a shortcut that contains it, an iPhone user cannot run that part. Keep that in mind when you choose a sharing audience.
What the recipient sees on import
When someone opens your link or file, Shortcuts shows the steps before it adds the shortcut. A recipient should:
- Open the shortcut and read every action from top to bottom.
- Look for actions that send data out: Get Contents of URL, Send Message, Send Email, and anything that posts to a web service.
- Look for Run Shell Script, Run AppleScript and Run JavaScript on Web Page. These can do far more than a typical action.
- Check the text inside those actions, not just their names.
- Add the shortcut only if every step makes sense.
Shortcuts also warns about shortcuts from outside your own library. Depending on your settings, you may need to enable running shared shortcuts, and some actions require extra confirmation. Treat these prompts as a prompt to read, not a box to click through.
Permissions: three layers
Shortcuts controls access in three layers. It helps to keep them separate in your head.
Layer 1: per-shortcut approval for sensitive data
The first time a shortcut accesses something private, Shortcuts asks you. Examples include a folder in Documents or Desktop, your contacts, your calendar, or a network request to a new domain. The prompt names the shortcut and the thing it wants. You choose Allow Once, Always Allow or Don't Allow, and the exact wording can differ by macOS version.
Always Allow is remembered for that shortcut and that resource. It does not carry over to other shortcuts.
Layer 2: macOS privacy settings
The Shortcuts app itself, and any app a shortcut drives, are also subject to System Settings > Privacy & Security. For example, a shortcut that reads files in a protected folder depends on Files and Folders access, and one that controls another app may need Automation or Accessibility access. If an action fails with a permission error, check this pane for Shortcuts and for the other app involved.
Layer 3: the Shortcuts app's own settings
Open Shortcuts > Settings. The Advanced tab (labeled differently in some versions) contains switches that control powerful features, such as whether scripting actions can run. Leaving these off is the safest default. Turn one on only if a shortcut you trust needs it.
Reviewing what a shortcut can do
Shortcuts offers a privacy view for each shortcut. In the editor, open the shortcut's details (the information button, or Shortcut Details in the toolbar). Two parts matter here:
- The Privacy tab shows which apps and data types the shortcut can reach, and it lets you revoke earlier approvals. Look for a section listing allowed apps, folders or domains.
- The setting for showing the shortcut in the menu bar, the Dock, Services or as a Quick Action affects where it can be started, which is also part of its exposure.
To reset everything, open System Settings > Privacy & Security and remove Shortcuts from the relevant categories. The next run prompts again.
You can also check a shortcut from Terminal. This lists the names in your library, so you can see what is installed:
shortcuts listTo inspect a shortcut that you received as a file before importing it, check the file type and size first:
file ~/Downloads/Resize\ Images.shortcut
ls -l ~/Downloads/Resize\ Images.shortcutA .shortcut file is a property list. Signed files are wrapped in a signed container, so you may not be able to read the contents as text. Importing and reading the steps in the editor is the dependable way to review it.
Preparing a shortcut for sharing
Before you share, work through this checklist.
- Remove personal values. Look for your name, email address, home folder paths, API keys, tokens and phone numbers. Search inside Text actions, URLs and shell scripts.
- Replace fixed values with prompts. Instead of hard-coding
/Users/alex/Documents/Reports, use a Choose Folder or Ask for Input action. The recipient then supplies their own path. - Use Import Questions. The editor can ask the recipient to fill in values when they add the shortcut, such as a folder or a name. Use it for any setting that must differ per person.
- Check dependencies. If the shortcut calls another shortcut, a shell tool such as
jqorffmpeg, or a third-party app, say so in the description. - Write a description. State what it does, which data it touches and which actions need permission. A recipient can then compare your description with the steps.
- Test on a clean account or second Mac. Permission prompts and missing dependencies appear only on a machine that has not seen the shortcut before.
- Remove debugging leftovers. Delete extra Show Result or Quick Look actions you used while building.
Keeping secrets out of shared shortcuts
Never place a password or token in a Text action. It is saved in plain form inside the shortcut and anyone who gets the link or file can read it. Use Ask for Input at run time, or have the script read the value from the macOS Keychain with the security command. A shell script can fetch a stored item like this:
security find-generic-password -s "my-service" -wThe recipient must create that Keychain item themselves, and macOS asks them to approve access. Document this in the description.
A review pass on an example shortcut
Suppose you receive a shortcut called Tidy Downloads. Its steps are:
- Get Contents of Folder (Downloads)
- Repeat with Each item
- Run Shell Script with
rm -rfon items older than 30 days - Get Contents of URL (a web address you do not recognise)
A careful review raises three questions:
- Step 3 deletes files. Does the script limit itself to the Downloads folder, or could a variable make it match something else?
- Step 4 contacts an unknown server. What data does it send? A POST request with file names would leak information.
- The shortcut does not explain either step in its description.
You would decline to add it, or you would delete step 4 and test step 3 on a copy of the folder. The point is that the review happens before the first run, since the first run is when the damage can occur.
Common problems
| Symptom | Likely cause | What to do |
|---|---|---|
| Recipient cannot run the shortcut | Running shared shortcuts or scripting is switched off | Open Shortcuts > Settings and check the relevant setting, only if they trust the source |
| Shortcut fails with a permission error | A folder or app was denied | Check Privacy & Security and the shortcut's Privacy tab |
| Works for you, fails for them | Hard-coded paths or a missing tool | Replace paths with prompts, document tools |
| Shell action missing on iPhone | The action is macOS only | Provide a separate version or avoid the action |
| Old behaviour after an update | The recipient used the old iCloud link | Send a fresh link or file |
| Prompts repeat every run | Allow Once was chosen | Choose Always Allow only after review, or fix the cause |
Summary of habits
- Read before you add. Read before you run.
- Share the smallest shortcut that does the job.
- Use prompts and Import Questions instead of fixed values.
- Keep secrets out of the shortcut itself.
- Grant Always Allow rarely, and review approvals from time to time.
Exercise
You are about to share a shortcut that contains a Run Shell Script action with a hard-coded path /Users/sam/Projects/data.csv and an API token typed into a Text action. List three changes you make before sharing.
Show answer
1) Replace the hard-coded path with a Choose File or Ask for Input action, or with an Import Question, so the recipient supplies their own file. 2) Remove the token from the Text action and ask for it at run time, or read it from the Keychain with the security command, and document that in the description. 3) Add a description stating that the shortcut runs a shell script, which data it touches and that it works only on macOS. Testing on a second Mac or clean account is also a good step.
Exercise
A colleague sends you an iCloud link to a shortcut. Name two kinds of actions you check first, and explain why a shortcut that worked yesterday might ask for permission again today.
Show answer
Check actions that send data out (Get Contents of URL, Send Message, Send Email) and actions that run code (Run Shell Script, Run AppleScript). It may ask again because you chose Allow Once earlier, because the shortcut now touches a new folder, app or domain, or because the permission was revoked in the Privacy tab or in Privacy & Security.