Set Cursor as the Default File Editor on macOS
Learn how to make Cursor your default editor for specific file types using the terminal-based tool, duti.
Efficiency in your development environment can significantly enhance productivity. If Cursor is your preferred editor, this guide will show you how to make it the default for specific file types using the terminal-based tool duti
. Here’s how to do it.
Pro Tip: You can also use this method to set VSCode as the default editor for specific file types. Just replace Cursor
with Visual Studio Code
in the commands.
Steps to Set Cursor as the Default Editor
1. Get Cursor’s Bundle Identifier
Retrieve Cursor’s unique bundle identifier. Open Terminal and run:
1
osascript -e 'id of app "Cursor"'
You’ll get a result like:
1
com.todesktop.230313mzl4w4u92
Take note of this identifier for the next steps.
2. Install duti
Install duti
via Homebrew if it’s not already installed:
1
brew install duti
duti
lets you change default file associations directly from the terminal.
3. Associate File Extensions with Cursor
Assign Cursor as the default editor for your desired file extensions. Use the following command:
1
duti -s com.todesktop.230313mzl4w4u92 .py all
Replace .py
with any file extension you use (e.g., .js
, .swift
). Repeat this step for each file type.
4. Customize for Your Workflow
Here’s how you might use it for common file types:
Choose your preferred editor:
What This Achieves
Automatic File Association
Files with specified extensions will open in Cursor when double-clicked, bypassing Finder’s manual settings.
Easy Updates
Modify or add new associations anytime by re-running duti
commands with different extensions.
Why Use duti
?
- Efficiency: Automates the setup process.
- Consistency: Keeps your workflow streamlined.
- Time-Saving: Avoids repetitive manual changes for each file type.
By following these steps, you’ll ensure that Cursor is always ready to handle your programming files. Happy coding!