macOS Automator Quick Action that runs selected code files from Finder in a new Terminal window.
The action supports executable files with a shebang and common script extensions:
.shwithbash.pywithpython3.jswithnode.tswithnpx ts-node.rbwithruby.phpwithphp.plwithperl.luawithlua
- Open Automator.
- Create a new Quick Action.
- Set the workflow to receive files or folders in Finder.
- Add Run Shell Script.
- Set Shell to
/bin/zsh. - Set Pass input to as arguments.
- Paste the contents of
src/run-code-file.sh. - Save it as
Run Code File.
After saving, select a script in Finder, right-click it, then choose Quick Actions > Run Code File.
- Files with a shebang are made executable with
chmod +xand then run directly. - Files without a shebang are run according to their extension.
- Unsupported extensions open Terminal and show a short unsupported-file message.
- The required runtime must already be installed and available in your shell path.
MIT