How to prevent the "code . " command in the terminal from opening Cursor

Hi. I’ve been using Cursor for a while now and it’s really great.

One thing that really irritates me, however, is the fact that after installing Cursor, when I run the "code . " command in the terminal, instead of launching my default VSC editor, Cursor is launched.

How do I get VSC back to opening on this command? Cursor is great, but I still want to leave "code ." for VSCode.

3 Likes

You need to reinstall the “code” command from normal VSCode so that it overrides it again.

Weird, but I can’t see this command. But isn’t this instruction only for macOS? I am working on windows

Hmm. You should also get the option to install the “code” command when running the VSC installer.

If you’re in Windows, open Run (Win+R) and type:
%localappdata%\Programs\cursor\resources\app\bin

Delete two files:

  • code
  • code.cmd

I hope this helped.

12 Likes

I have the same problem. Not sure if I should reinstall the Appimage by deleting it or something else

This solved the problem for me.

My issue was that after installing Cursor in Windows, the “code” command in WSL2 stopped working.

The error message was “Unable to determine app path from symlink : /mnt/c/Users/Ivan/AppData/Local/Programs/cursor/resources/app/bin/code”

After deleting the 2 files and launching “code” in wsl2, VSCode started installing itself again.

This is so obnoxious. Just highlights the fact that there is no reason this shouldn’t be an VS code extension rather than piggybacking on top of Code breaking things left and right.

1 Like

Worked. And a note to the devs, this intrusive behavior is only irritating and makes me look harder for other tools.

3 Likes

My solution for this was to rename the code command to cur.

I also added the VS Code folder to the system path before Cursor, just in case.

It works for me. Thanks!

If you’re in Windows, open Run (Win+R) and type:
%localappdata%\Programs\cursor\resources\app\bin

Delete two files:

  • code
  • code.cmd

I hope this helped.

Note -

  • If you are deleting above files make sure you will re-start the terminal cause it will still look the same path for code command and give the error that code is not found in \Programs\cursor\resources\app\bin.

  • the above step helps you delete the over written file written by cursor to open it using terminal command “code” which was for vs code.

  • now to open any directory in-

cursor -

cursor _dirname

VScode -

code _dirname

Faced this issue on Mac OS. The cursor application overrides the code command and the only way to revert this is delete the code script (rm /usr/local/bin/code) and install ‘code’ command in PATH.

Alternatively you can edit the code script (nano /usr/local/bin/code).

-	REMOTE_CLI="$(which -a 'cursor' | grep /remote-cli/)"
+	REMOTE_CLI="$(which -a 'code' | grep /remote-cli/)"


- ELECTRON="$CONTENTS/MacOS/Cursor"
+ ELECTRON="$CONTENTS/MacOS/Electron"

This way, cursor would run cursor application and code runs vs code.

works for me, thank you :slight_smile:

No need to delete anything on Windows, just make sure the path to VS Code is set before the path to Cursor. That’s all that’s needed to make this work.

Thanks for sharing. Alternatively, renaming the files to code_old and code_old.cmd seems to work too.

using windows, and the suggestion to delete the 2 files worked!

until it came back…

I have a feeling this has to do with cursor updates? I actually uninstalled cursor, rebooted and installed. It never asked me (like the first time) if I wanted to use “code” to open cursor and those files showed up upon the fresh install. Any suggestions? Where does the choice to use “code” to open cursor get stored during install?