TechEarl

How to Add a Right-Click Quick Action to macOS Finder

Add a custom right-click action to macOS Finder with Automator. Build a Quick Action that runs a shell script on the files you select, with the PATH gotcha that makes it silently do nothing.

Ishan Karunaratne⏱️ 9 min readUpdated
Share thisCopied
Build a custom right-click Quick Action in macOS Finder with Automator: run a shell script on selected files, loop over the arguments, and fix the minimal-PATH trap on Apple Silicon.

To add a custom right-click action to macOS Finder, build a Quick Action in Automator: open Automator, choose New Document > Quick Action, set it to receive files or folders in Finder, drop in a Run Shell Script action, switch its input to as arguments, write a loop over "$@", and save it. The action then appears when you right-click a file in Finder, under the Quick Actions submenu. That is the whole mechanism. The rest of this page is the detail that makes it actually fire, including the one trap that makes a Quick Action silently do nothing.

If you searched for how to add a "Service" to the Finder menu, that is the same feature. Apple renamed Services to Quick Actions in macOS Mojave (10.14, 2018). The Automator document type you pick is still labelled "Quick Action," and the result still saves into ~/Library/Services, so old "create a Finder Service" tutorials work; only the name changed.

Build the Quick Action

  1. Open Automator (it ships with macOS, in /Applications).
  2. File > New, pick Quick Action, click Choose.
  3. At the top of the workflow area, set Workflow receives current to files or folders, and in to Finder.app. This is what makes the action show up on a right-click in Finder and hands it the selected items.
  4. In the left-hand library, find Run Shell Script (it is under Utilities) and drag it onto the canvas.
  5. In the Run Shell Script action, set Shell to /bin/bash (or /bin/zsh) and, critically, set Pass input to as arguments.
  6. Replace the default script with your own (the example below).
  7. File > Save, give it a name like "Convert to PNG." That name is exactly what shows up in the right-click menu.

The Pass input: as arguments setting is the part people get wrong. The other option, to stdin, dumps every selected path into the script's standard input as one newline-separated blob, which you then have to read and split by hand. "As arguments" hands each selected file to your script as a normal positional argument, so you can loop over them the way you would in any shell script. Use arguments unless you have a specific reason not to.

Loop over the selected files

With input passed as arguments, the selected files arrive in "$@", the positional parameters. Always loop over them. Finder lets the user select more than one file, and a Quick Action that only handles $1 will quietly ignore everything after the first item.

bash
for f in "$@"; do
  # "$f" is one selected file's full path
  echo "$f"
done

Quote "$f" and quote "$@". Mac filenames are full of spaces ("Screen Shot 2026-06-01 at 9.00.00 AM.png" is a real default), and an unquoted loop variable splits that into five broken arguments. This is the single most common reason a Quick Action works on your test file and breaks on a real one.

A worked example: convert dropped images to PNG

Here is a complete, useful action. It converts every selected image to PNG using ImageMagick's magick tool, writing the result next to the original. Drop this into the Run Shell Script box:

bash
# Full path to the brew-installed binary, not a bare `magick`.
MAGICK="/opt/homebrew/bin/magick"      # Apple Silicon
# MAGICK="/usr/local/bin/magick"       # Intel Mac

for f in "$@"; do
  out="${f%.*}.png"
  "$MAGICK" "$f" "$out"
done

Install the tool first with brew install imagemagick. The interesting line is the first one, and it is the headline gotcha of this whole topic.

The PATH trap that makes a Quick Action do nothing

The number-one reason a Quick Action runs and silently produces no result is PATH. The shell that Automator spawns does not load your .zshrc or .bash_profile, so it does not inherit the PATH you see in Terminal. It runs with a minimal, sanitized environment, typically only /usr/bin:/bin:/usr/sbin:/sbin. Anything you installed with Homebrew is not on that PATH.

So a script that calls a bare magick, ffmpeg, unrar, pngquant, or python3 works perfectly when you paste it into Terminal, then does absolutely nothing as a Quick Action, with no visible error, because the binary cannot be found. The fix is to call the tool by its full path:

  • Apple Silicon (M1 and later): Homebrew installs to /opt/homebrew/bin, so the binary is /opt/homebrew/bin/magick.
  • Intel Macs: Homebrew installs to /usr/local/bin, so it is /usr/local/bin/magick.

Run which magick (or brew --prefix) in Terminal once to confirm the path on your machine, then hardcode it in the script. If you want the script to work on both architectures without editing, prepend both directories to PATH at the top instead:

bash
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"

When a Quick Action does nothing, check the binary path before you check anything else. It is almost always this.

Manage and remove Quick Actions

Once saved, a Quick Action is just a .workflow bundle in ~/Library/Services. You can delete the file there to remove the action entirely, or rename the file to rename the menu item.

To turn actions on and off without deleting them, open System Settings > General > Login Items & Extensions, scroll to the Finder entry, and click the i (info) button next to it. That panel lists every Quick Action; tick or untick each one to show or hide it in the right-click menu, and drag to reorder. Apple moved this in macOS Sequoia (15): on Ventura and Sonoma the same list is under System Settings > Privacy & Security > Extensions > Finder, and on macOS before Ventura it was System Preferences > Extensions > Finder. The list and the toggles are identical at every version; only the location of the panel changed.

You will also see Quick Actions in the Finder preview pane (turn it on with View > Show Preview, then Show Quick Actions at the bottom). Single-file actions like Rotate and Markup show up there as buttons, alongside any custom ones you add.

The modern alternative: the Shortcuts app

Automator still works and is the right tool for a "run this shell script on these files" action. But Apple's newer Shortcuts app (built into macOS since Monterey, 2021) is where Apple is putting its effort, and it can also produce Finder Quick Actions.

In Shortcuts, build a shortcut, double-click it to open it, click Details in the right-hand inspector, and tick Use as Quick Action, then Finder. A shortcut can still run a shell script (the Run Shell Script action exists in Shortcuts too, with the same PATH caveat above), so anything Automator does, Shortcuts can do, plus it syncs across your devices via iCloud and is far easier to edit later. For a brand-new action today, I reach for Shortcuts; for the dozens of existing .workflow files people already have, Automator is still fully supported.

If shell scripting on macOS is new territory, the open command is a good companion: a Quick Action that opens the selected files in a specific app is a one-liner once you know it.

FAQ

See also

Sources

Authoritative references this article was fact-checked against.

TagsmacOSFinderAutomatorQuick Actioncontext menushell scriptApple Silicon

Found this useful? Pass it on.

Copied

Ishan Karunaratne

Tech Architect · Software Engineer · AI/DevOps

Tech architect and software engineer with 20+ years building software, Linux systems, and DevOps infrastructure, and lately working AI into the stack. Currently Chief Technology Officer at a healthcare tech startup, which is where most of these field notes come from.

Keep reading

Related posts

How to Add a Column to a MySQL Table

Add a column to a MySQL table with ALTER TABLE ADD COLUMN. Covers DEFAULT values, NOT NULL on existing rows, AFTER positioning, and ALGORITHM=INSTANT on MySQL 8.0.12+.