DEV Community

Cover image for Creating a "Open in Cursor" Context Menu for macOS Finder
netsi1964 πŸ™πŸ»
netsi1964 πŸ™πŸ»

Posted on

Creating a "Open in Cursor" Context Menu for macOS Finder

TLDR

Add a custom "Open in Cursor" option to your Finder context menu by creating an Automator Quick Action with AppleScript. Makes opening projects in Cursor a breeze!

Why You Need This

As developers, we often browse our filesystems looking for projects to work on. If you're using Cursor as your code editor (which many are, for its excellent AI integration), you'll quickly get tired of:

  1. Finding a folder in Finder
  2. Opening Cursor separately
  3. Navigating to the same folder through Cursor's interface

This quick automation adds a right-click option to instantly open any folder or file in Cursor, directly from Finder!

The Complete Guide

Prerequisites

  • macOS (tested on Monterey, Big Sur, and Ventura)
  • Cursor installed at /Applications/Cursor.app
  • 5 minutes of your time

Step 1: Open Automator

Find Automator in your Applications folder or search for it using Spotlight (⌘+Space).

Step 2: Create a New Quick Action

  1. When Automator opens, select Quick Action (or "Service" in older macOS versions)
  2. Configure the workflow settings at the top:
    • Workflow receives: files and folders
    • in: Finder

Step 3: Add an AppleScript Action

  1. Search for "Run AppleScript" in the actions library
  2. Drag it to the workflow area

Step 4: Add the Script

Replace the default AppleScript code with:

on run {input, parameters} try repeat with i from 1 to count of input set theItem to item i of input set thePath to quoted form of POSIX path of theItem do shell script "/usr/bin/open -a '/Applications/Cursor.app' " & thePath end repeat return input on error errMsg display dialog "Error opening files in Cursor: " & errMsg buttons {"OK"} default button 1 return input end try end run 
Enter fullscreen mode Exit fullscreen mode

Step 5: Save Your Quick Action

  1. Choose File > Save
  2. Name it "Open in Cursor" (or whatever you prefer)
  3. Click Save

Step 6: Use Your New Action

  1. In Finder, right-click on any file or folder
  2. Look for "Open in Cursor" in the context menu or under "Quick Actions"
  3. Click it, and watch as your selection opens in Cursor!

Troubleshooting

If your menu item doesn't appear:

  • Go to System Preferences > Extensions > Finder and ensure "Open in Cursor" is enabled
  • If your Cursor app is installed elsewhere, modify the path in the script

If you receive an error message:

  • Check that Cursor is properly installed
  • Ensure the path in the script matches your installation

Customization (Optional)

Want this to be even more accessible? Assign a keyboard shortcut:

  1. Go to System Preferences > Keyboard > Shortcuts > Services
  2. Find "Open in Cursor" under "Files and Folders"
  3. Click on it and press your desired key combination

Why This Works

This automation uses AppleScript to grab the selected file paths from Finder and passes them to the open command with Cursor specified as the application. The error handling ensures you're notified if something goes wrong.

Conclusion

Small automations like this can significantly improve your development workflow. No more tedious navigation through multiple interfaces - just right-click and get to coding!

What other Finder integrations would you find useful? Let me know in the comments!

Top comments (1)

Collapse
 
avoajaugochukwu profile image
Ugochukwu Avoaja

Thank you for sharing.
I tried so many solutions, including the known technique for VS Code.