Every time I switch devices, I end up searching how to create this simple shortcut π So Iβm putting it here for good β and if it helps you too, awesome! ππ»β¨
β Step 1 β Open Automator
Press Cmd + Space and type Automator, then hit Enter.
Choose Quick Action and click Choose.
β Step 2 β Configure Workflow Input
At the top of the window:
Workflow receives current: files or folders
in: Finder
Input: entire selection
You can choose any icon or color if you like, but itβs optional.
β Step 3 β Add Run Shell Script Action
In the search bar on the left, type Run Shell Script.
Drag Run Shell Script to the workflow area.
Configure it as follows:
Shell: /bin/zsh
(or /bin/bash
if you prefer)
Pass input: as arguments
β Step 4 β Add the Script for Cursor
Paste this inside the Run Shell Script block:
open -n -b "$(osascript -e 'id of app "Cursor"')" --args "$@"
β
Notes:
osascript -e 'id of app "Cursor"' dynamically finds the bundle ID of Cursor, so you don't have to hardcode it.
"$@" ensures that all selected files/folders are passed correctly.
β Step 5 β Save the Quick Action
Press Cmd + S
.
Name it Open in Cursor
.
Click Save.
β Step 6 β Assign a Keyboard Shortcut
Open System Settings β Keyboard β Keyboard Shortcuts.
Go to Services β Files and Folders.
Find Open in Cursor.
Click it and assign the shortcut F12 (or any key you prefer).
β Step 7 β Test It
Select a file or folder in Finder.
Right-click β Quick Actions β Open in Cursor, or press F12.
β For VSCode, Modify the Script Like This:
If you want a similar shortcut to open files in VSCode, just replace the script with:
open -n -b "com.microsoft.VSCode" --args "$@"
This directly uses VSCodeβs bundle ID without needing osascript.
β Final Notes
You can use osascript -e 'id of app "App Name"' for any app if you don't want to hardcode the bundle ID.
The -n flag ensures it opens a new instance.
The --args "$@" part forwards the selected files or folders to the app.
Top comments (0)