Last active
February 6, 2025 07:50
-
Star
(294)
You must be signed in to star a gist -
Fork
(52)
You must be signed in to fork a gist
-
-
Save tonysneed/f9f09bfa28bcf98e8d8306f9b21f99e2 to your computer and use it in GitHub Desktop.
Add a command to Finder services in Mac OSX to open a folder in VS Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Open Automator | |
- File -> New -> Service | |
- Change "Service Receives" to "files or folders" in "Finder" | |
- Add a "Run Shell Script" action | |
- Change "Pass input" to "as arguments" | |
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*" | |
- Save it as something like "Open in Visual Studio Code" |
Still works in MacOS Sonoma Mar 2024. Thank you! The "Quick Action" tip from above still applies.
In 2025, for MacOS Sonoma 14.4.1, I adapt it to behave like "Open in Cursor", and it works.
Use the following steps,
- Open Automator
- File > New
- Select Quick Action
- Click Choose
- Select "Workflow receives current files or folders in Finder"
- From the left hand side pane in Automator, drag-drop Library > Utilities > Run Shell Script into the right hand pane
- Ensure Pass input is set to "as arguments"
- Then paste the below text:
for f in "$@"
do
open -n -a "Cursor.app" --args "$f"
done
Then,
- Click File > Save
- Give name as "Open in Cursor"
- Go to Finder, select a folder or files, right click > choose Quick Actions > Open In Cursor
But If somebody can fork this OpenInCode project and makes it work for cursor, I will highly appreciate it.
I have tried and haven't figured it out, but its code is relatively simple.
Thanks to @xc1427 for sharing the method using the shell script.
I rather used simply Automator's built-in feature without using the shell script.
Let me share it here if it helps.
- Open Automator
- File > New
- Select Quick Action
- Search for "Open Finder Items" and drag it to the right panel
- Set "Workflow receives current" value to "Automatic (files or folders)" in "any application"
- Under Open Finder Items, change Open with: "Default Application" to Open with: "Cursor.app"
- Save with a custom name (e.g., Open with CursorAI)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Brilliant! Thanks