`code .` opens cursor
➜ cursor --version
0.9.3
e83fb25fe9144aa8b230e6f9ee2056e20fb24c70
x64
OS: Windows 11
I installed cursor few days ago. And during installation I was give 2 options, install code or cursor command. I chose cursor, and it works fine. But I just noticed that when I use code . it opens cursor which is not what I was expecting.
seems like a super annoying bug. really sorry for causing this. will investigate soon if this is a bug on our side. (cc: @Sanger2000) if this is, will release a hot fix!
I also encountered this issue some time ago and it happened because cursor added itself to the PATH before VS Code, instead of append itself, and since there is a code and code.cmd executable in there the code command would open cursor. This is despite me explicitly not choosing to override code with cursor during setup.
AppData\Local\Programs\cursor\resources\app\bin\ (contains code, code.cmd, cursor, cursor.cmd)
AppData\Local\Programs\Microsoft VS Code\bin\ (contains code, code.cmd)
For me it was extra annoying because all of the sudden the "VS Code" external code editor in GitKraken would 'appear' to be mapped to cursor instead of code, with no way of changing it (other than uninstall cursor).
But changing the order of the PATH (code before cursor) fixed it for me.
same issue for me. this is very upsetting. vscode is still my main IDE and I installed cursor to try it out for a while to see if maybe I would replace vscode down the road. I am uninstalling cursor because of this.
Any news? This is still a problem.
I am also looking for a fix, I am deleting
remove-item c:\Users\<username>\AppData\Local\Programs\cursor\resources\app\bin\code.cmd
remove-item c:\Users\<username>AppData\Local\Programs\cursor\resources\app\bin\code
after every update
I accepted the code replacement, but can't find the setting, I would like to deactivate this feature
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.
The issues is still present till this day, I hope the team fix it soon, it's small but very annoying.
If you’re in Windows, go to %localappdata%\Programs\cursor\resources\app\bin and delete 2 files: code code.cmd I hope this helped.
@aady01, after removing these files, cursor . didn't work for me anymore.
I fixed it by adding the following alias to my .bashrc shell config file:
alias cursor='"C:\Users\<username>\AppData\Local\Programs\cursor\resources\app\bin\cursor"'
As a result cursor . launches cursor, while code . launches vscode as intended.
If you’re in Windows, go to %localappdata%\Programs\cursor\resources\app\bin and delete 2 files: code code.cmd I hope this helped.
This is life saver. I accidentally enabled this and wanted to revert it.
FYI - I followed the suggestions above on my windows computer, deleting the 2 files:
%localappdata%\Programs\cursor\resources\app\bin\code %localappdata%\Programs\cursor\resources\app\bin\code.cmd
I've been using both commands (code and cursor) for about a month, and somehow it reset itself in the last week. So I'm having to delete it again.
It would be great if there were a permenant fix.
same
I agree in that installing first VSC before cursor did resolve it. Then when I have a Windows fresh installation, and installing cursor, pressing only install cursor command, then code command is registering
Hello, I am not an English speaker but I hope you understand me: When you install the editor it gives you these options:
By installing only the first one, what it does is that it somehow replaces the "code" of the vscode command line registered in the path with "cursor", which means that when you use "cursor" and "code" it opens Cursor, because "C:\Program Files\Microsoft VS Code\bin" was removed from the PATH
When you install only the second one, what it does is that it adds you to your command line and registers the "cursor" in the path (it does not affect the "code" of vscode), that is, you have "code" to open vscode and "cursor" to open Cursor, both separately
And when you install both you give priority to Cursor
To solve this there are several ways (if you installed both options) and you want to have the "code" and "cursor" separately:
- Within Cursor you can do Ctrl+Shift+P and there search for "Shell Command: uninstall 'code' command from path" and click on that option (but in the PATH it is still registered)
- Go to your environment variable (path) and delete "c:\Users[Your User Name]\AppData\Local\Programs\cursor\resources\app\bin" (you will see two, just delete one) and add the command line for VScode "C:\Program Files\Microsoft VS Code\bin" and that should be it.
The other way is to uninstall Cursor completely
- Uninstall Cursor.
- You delete these folders "C:\Users\TU_USER\AppData\Roaming\Cursor" and "C:\Users\TU_USUARIO.cursor" within the PATH you delete this "c:\Users\TU_USER\AppData\Local\Programs\cursor\resources\app\bin"
- You install Cursor again and it should show you the entire installation process
This issue is still not resolved, nearly two years later.
For me, the fix was: The VS Code 'code' command was only in the User PATH, while the cursor 'code' command was both in the User and System PATH. I used win + R to launch 'sysdm.cpl', and opened Environment Variables (under the 'Advanced' tab). From there, I copied the VS Code path from user PATH to the System PATH. The VS Code command then took priority over Cursor's. I guess this would persist across Cursor updates? Not sure.
That is what it says, that when you install Cursor and install its command line it eliminates the vscode path and deletes it in the ENVIRONMENT VARIABLE, that is why it is only necessary to choose the cursor (when it is a clean installation) and now for your case it seems that you installed vscode for the system and for your current user (which would not be a good option if you are the only one who uses your computer and also that you will have not very extensive problems in the path but there are some), now what you just did should solve your problem because you reset the vscode path in the environment variable (which at the time Cursor deleted it) now if what you want is to have code for VSCODE and cursor for CURSOR, it would be that you follow the steps that I left you (I will be informed if you have any problems.)
And if Cursor is an Editor in development, there were recently problems in an update, it is also worth keeping up to date on its Cursor forum
I'm on Mac. Tried some of the solutions here and didn't work. What worked for me was:
- Delete the current script: sudo rm /usr/local/bin/code
- Open VS Code (you'll need to find it in your Applications folder)
- Open the Command Palette (Cmd+Shift+P)
- Type and select "Shell Command: Install 'code' command in PATH"
On the Mac. Open the Command Palette (Cmd+Shift+P), type 'shell command', and run the Shell Command: Install 'code' command in PATH command.
Then VS Code would override it.
This issue is still not resolved, nearly two years later.
For me, the fix was: The VS Code 'code' command was only in the User PATH, while the cursor 'code' command was both in the User and System PATH. I used win + R to launch 'sysdm.cpl', and opened Environment Variables (under the 'Advanced' tab). From there, I copied the VS Code path from user PATH to the System PATH. The VS Code command then took priority over Cursor's. I guess this would persist across Cursor updates? Not sure.
Thanks, this works for me.
Oh and for my windows machine, the path for vscode needs to be moved up to higher than cursor's path for it to work.
At least for now, I can use code code . to open vscode and cursor cursor . to open cursor.
Is this what we call aggresive marketing? I thought i would start with cursor, and i was really suprised to see it launching instead of my traditional well-known vsc
Is this what we call
aggresivemarketing? I thought i would start with cursor, and i was really suprised to see it launching instead of my traditional well-known vsc
I don't even consider it a marketing strategy, it's unethical. Such thing is considered a dark pattern UX, also known as deceptive design pattern.
This issue is still not resolved, nearly two years later.
For me, the fix was: The VS Code 'code' command was only in the User PATH, while the cursor 'code' command was both in the User and System PATH. I used win + R to launch 'sysdm.cpl', and opened Environment Variables (under the 'Advanced' tab). From there, I copied the VS Code path from user PATH to the System PATH. The VS Code command then took priority over Cursor's. I guess this would persist across Cursor updates? Not sure.
This is my solution for now. Thank you, @bipboop1. I also agree with @derciojds. A bug that has lasted for two years? Nope, it's intentional.
I am here to say some very nasty words, it is very annoying and disgusting to automatically register cursor as code after every update or in the random period, as I said many times NO in the cursor settings / by deleting the code,code.cmd file from the C:\Users\USERNAME\AppData\Local\Programs\cursor\resources\app\bin and changing the priority in environment variables. It is a very aggressive and unethical strategy, but you guys chose to keep doing this, for the issue has been open for nearly 2 years.
Same issue. Even removing code from the cursor path and reinstalling VSCode didn't overwrite it.
If you're encountering issues with the code command opening the cursor, try running
where code on Windows
or
which code on Linux. You might see paths like:
C:\Users\<username>\AppData\Local\Programs\cursor\resources\app\bin\code
C:\Users\<username>\AppData\Local\Programs\cursor\resources\app\bin\code.cmd
C:\Users\<username>\AppData\Local\Programs\Microsoft VS Code\bin\code
C:\Users\<username>\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd
or their equivalents on Linux.
In my case, removing the entries under the cursor\resources\app\bin\ directory resolved the issue. It seems like those were taking precedence over the official VS Code paths.
Hope this helps!
try to delete os path item that contains cursor but not working, now I decide to uninstall cursor to fix it.
If you’re in Windows, go to %localappdata%\Programs\cursor\resources\app\bin and delete 2 files: code code.cmd I hope this helped.
Thanks it worked very well
modifing the path manually so the real code would be found first is not a solution or a fix -- its a workaround
The method mentioned above does work, but previously, even after doing that, cursor updates would still change the user configuration. However, this hasn't happened in the most recent updates, probably because the development team felt the users' anger, LOL.