The Cursor AI Code Editor annoyingly sets all of the file extensions associated with VSCode to open with Cursor and changes all the default file specific icons to the cursor icon on MacOS (see getcursor/cursor#1052). Resetting them all manually is frustrating. So this script automates the process of changing the default application for file extensions associated with the Cursor
app back to Visual Studio Code
. It uses macOS utilities such as lsregister
to identify file associations and duti
to update them. After making changes, it restarts Finder and Dock to apply the updates immediately.
Even after running the script, Finder will still show the Cursor icon on some of the files. Right click, and select "Get Info". The correct icon should be displayed in the left corner and then will update in the finder. Close and reopen Finder and it should update the rest. If there are some stragglers, rinse and repeat.
- Identifies all file extensions currently associated with the
Cursor
application. - Updates the default application for these extensions to
Visual Studio Code
. - Restarts Finder and Dock to ensure the changes take effect.
- macOS Utilities:
- Ensure you have
lsregister
available (part of macOS system utilities).
- Ensure you have
- Install
duti
:- Install
duti
via Homebrew:
- Install
brew install duti
- Verify
duti
installation:
duti -v
- Visual Studio Code:
- Ensure
Visual Studio Code
is installed on your system.
- Ensure
- Clone or download the script to your local machine.
- Make the script executable:
chmod +x reset_exts.sh
- Run the script to update file associations:
./reset_exts.sh
- The script will:
- Find all file extensions associated with the
Cursor
app. - Change their default application to
Visual Studio Code
. - Restart Finder and Dock to apply changes immediately.
- Find all file extensions associated with the
The script will output the extensions being processed, for example:
Processing extension: .svg
Processing extension: .md
Processing extension: .json
Restarting Finder and Dock to apply changes...
Update complete!
To verify that the changes were successful, use the following command:
duti -x <extension>
For example:
duti -x svg
Expected output:
com.microsoft.VSCode
/Applications/Visual Studio Code.app
- The script only updates extensions currently associated with
Cursor
. - Ensure
Visual Studio Code
is properly installed; otherwise, the changes won't take effect.
duti
Not Found:- Ensure
duti
is installed via Homebrew:
- Ensure
brew install duti
- Changes Not Reflected:
- Manually restart Finder and Dock:
killall Finder
killall Dock
This script is open-source and provided as-is. Feel free to modify and adapt it for your needs.