cursor icon indicating copy to clipboard operation
cursor copied to clipboard

WSL: cursor command fails to find the correct entrypoint

Open LudwigStumpp opened this issue 1 year ago • 26 comments

Issue

Calling cursor command on WSL2 fails

To use Cursor with the Windows Subsystem for Linux, please install Cursor in Windows and uninstall the Linux version in WSL. You can then use the `cursor` command in a WSL terminal just as you would in a normal command prompt.
Do you want to continue anyway? [y/N] y
To no longer see this prompt, start Cursor with the environment variable DONT_PROMPT_WSL_INSTALL defined.
/mnt/c/Users/ludwi/AppData/Local/Programs/cursor/resources/app/bin/cursor: 62: /mnt/c/Users/ludwi/AppData/Local/Programs/cursor/resources/app/bin/../cursor: not found

Specification

  • Windows 11 Home; Version 22H2; Build 22621.2134
  • WSL2 with Ubuntu 20.04 LTS
  • Cursor Version: 0.8.5 VSCode Version: 1.80.1 Commit: 74f6148eb9ea00507ec113ec51c489d6ffb4b771 Date: 2023-08-26T19:52:38.290Z Electron: 22.3.10 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Windows_NT x64 10.0.22621

WSL2 Path has

  • /mnt/c/Users/{USER}/AppData/Local/Programs/cursor/resources/app/bin

Note

  • I installed Cursor through the Windows installation
  • I am however able to use cursor in WSL by connecting to it from Windows with the command >WSL: Connect to WSL

Has anyone experienced the same issue or has an idea for me to try out?

LudwigStumpp avatar Aug 27 '23 12:08 LudwigStumpp

Not exactly solving the issue, but just in case fyi - had a similar issue and ended up adding the WSL extension to the Cursor IDE - now using the WSL terminal / Cursor there and that's working well for me atm.

ArcAnya avatar Aug 28 '23 14:08 ArcAnya

Not exactly solving the issue, but just in case fyi - had a similar issue and ended up adding the WSL extension to the Cursor IDE - now using the WSL terminal / Cursor there and that's working well for me atm.

Hi, thanks for your additional input on this. Indeed for me within the WSL extension I am also able to open any folder on the WSL from within the IDE. However I would like to be able to use the cursor command from the WSL terminal (as it works the same for VSCode).

LudwigStumpp avatar Aug 28 '23 18:08 LudwigStumpp

Although this is not a blocker but it is really convenient to open your folders from wsl terminal. facing exactly same issue.

mfaizan1 avatar Sep 13 '23 11:09 mfaizan1

For some reason the default cursor shell script is very different from the equivalent code script from VSCode. Maybe it was forked from an earlier branch?

In any case, I took the latest VSCode code script and modified it for Cursor and WSL. It works well for me and I'm able to launch Cursor directly from a WSL prompt, e.g.:

$ cursor .

Here's the gist: https://gist.github.com/ddwang/0046da801bcb29d241869d37ad719394

To use, simply replace your cursor script, usually found at /mnt/c/Users/<USER_NAME>/AppData/Local/Programs/cursor/resources/app/bin/cursor

ddwang avatar Sep 21 '23 05:09 ddwang

@ddwang your script works perfectly for me, but it downloads the vs code server every time I run "cursor ." Unlike vs code which just does that once and opens normally on subsequent runs

ksumesh431 avatar Sep 27 '23 03:09 ksumesh431

Another use case is to apply the $PATH from the Terminal to Cursor.

llllvvuu avatar Nov 01 '23 08:11 llllvvuu

I use @ddwang's script and so far it is working. But I have problems opening two or more projects at the same time from WSL in Cursor. Having opened a WSL project in Cursor and then starting Cursor from WSL in a different project directory, Cursor starts but then displays the error message "Could not fetch remote environment".

vincentsch avatar Feb 14 '24 10:02 vincentsch

Another observation is that I have to repeat the process of replacing the script every few days. The script is apparently being reset to its original state on a regular schedule.

I can also no longer start the original VSCode with code . Instead, I keep getting the following error message:

Unable to determine app path from symlink : /mnt/c/Users/<User>/AppData/Local/Programs/cursor/resources/app/bin/code

vincentsch avatar Feb 20 '24 08:02 vincentsch

@vincentsch thanks for the debugging. I'll take a look this wknd and hopefully resolve these issues

ddwang avatar Feb 20 '24 21:02 ddwang

@vincentsch thanks for the debugging. I'll take a look this wknd and hopefully resolve these issues

Were you able to resolve this?

addiaddiaddi avatar Mar 27 '24 22:03 addiaddiaddi

I hope someone is working on this! I love using Cursor on my work macOS machine, but this is a blocker for me on my home Windows machine

schlich avatar Mar 28 '24 01:03 schlich

+1 Same issue on my WSL

sandeepnmenon avatar Apr 27 '24 05:04 sandeepnmenon

Still having this issue as well for anyone else running into this post. Fresh Win11 image + WSL2 install. Can connect to WSL remote when inside Cursor but can't do it through WSL terminal. Also tried the "Fix WSL install" through the command palette.

buencons avatar Jun 25 '24 13:06 buencons

Same here - still does not work from the console directly.

dkarelov avatar Jul 13 '24 10:07 dkarelov

any updates on this?

0x33dm avatar Jul 22 '24 06:07 0x33dm

I forked @ddwang 's script, made a couple improvements, and it's working for me: https://gist.github.com/swayducky/8ba8f2db156c7f445d562cdc12c0ddb4

Wasted way too much on this, but at least it works now 👍

swayducky avatar Jul 22 '24 22:07 swayducky

I forked @ddwang 's script, made a couple improvements, and it's working for me: https://gist.github.com/swayducky/8ba8f2db156c7f445d562cdc12c0ddb4

Wasted way too much on this, but at least it works now 👍

this worked for me, thanks a lot.

I didn't find cursor on my windows variables tough, so maybe i got a slightly different install from you as i just installed this on my windows machine a couple days ago.

Remove "c:\Users<USER_NAME>\AppData\Local\Programs\cursor\resources\app\bin" from Windows Environment Settings

0x33dm avatar Jul 23 '24 19:07 0x33dm

I forked @ddwang 's script, made a couple improvements, and it's working for me: https://gist.github.com/swayducky/8ba8f2db156c7f445d562cdc12c0ddb4

Wasted way too much on this, but at least it works now 👍

today i got this error:

ln: failed to create symbolic link '/home/xxx/.cursor-server/bin//bee043c1bb0095dab94043787985ccfc7cc38e50/bin/remote-cli/code': File exists

and when i opened cursor it seems it downloaded the WSL server again :(

0x33dm avatar Jul 24 '24 18:07 0x33dm

I forked @ddwang 's script, made a couple improvements, and it's working for me: https://gist.github.com/swayducky/8ba8f2db156c7f445d562cdc12c0ddb4

Wasted way too much on this, but at least it works now 👍

Rebooted my computer and now i get this

$ cursor .
ln: failed to create symbolic link '/home/xxx/.cursor-server/bin//1252dd54bee0d8caa777cd58df6ab01192a69c30/bin/remote-cli/code': File exists
/home/hems/.local/bin/cursor: 87: /mnt/c/Users/xxx/AppData/Local/Programs/cursor//Cursor.exe: not found

0x33dm avatar Jul 26 '24 07:07 0x33dm

Rebooted my computer and now i get this

$ cursor .
ln: failed to create symbolic link '/home/xxx/.cursor-server/bin//1252dd54bee0d8caa777cd58df6ab01192a69c30/bin/remote-cli/code': File exists
/home/hems/.local/bin/cursor: 87: /mnt/c/Users/xxx/AppData/Local/Programs/cursor//Cursor.exe: not found

and if i go to C:\Users\xxx\AppData\Local\Programs\cursor the entire folder is empty.

i had to download cursor again and install and it works again.

Cursor on WSL seems very unreliable. I wonder why the entire folder got wiped.

Maybe i accepted some update pop up and don't remember it. weird.

0x33dm avatar Jul 26 '24 08:07 0x33dm

I forked @ddwang 's script, made a couple improvements, and it's working for me: https://gist.github.com/swayducky/8ba8f2db156c7f445d562cdc12c0ddb4

Wasted way too much on this, but at least it works now 👍

it's work for me

Xnuvers007 avatar Jul 27 '24 03:07 Xnuvers007

Hvaing the same issue on WSL cursor . command will output:

image

To use Cursor with the Windows Subsystem for Linux, please install Cursor in Windows and uninstall the Linux version in WSL. You can then use the `cursor` command in a WSL terminal just as you would in a normal command prompt.
Do you want to continue anyway? [y/N] y
To no longer see this prompt, start Cursor with the environment variable DONT_PROMPT_WSL_INSTALL defined.
./cursor: 62: ./../cursor: not found

TimofeyBiryukov avatar Sep 03 '24 13:09 TimofeyBiryukov

Having the same issue.

jjovalle99 avatar Sep 04 '24 20:09 jjovalle99

Having the same issue.

cafesao avatar Sep 06 '24 19:09 cafesao

[When VSCode or Cursor updates,cursor perhaps have some problem. Use the following script to resolve.

  1. cd /usr/local/sbin/, create a file, mine is fix-cursor
  2. paste code below
#! /bin/bash
win_cursor_path="/mnt/c/Users/WINUSERNAME/AppData/Local/Programs/cursor/resources/app/bin/"
cd $win_cursor_path
wget -O cursor.sh https://gist.githubusercontent.com/ddwang/0046da801bcb29d241869d37ad719394/raw/088836e0d946de07a82c245066ef07ddc35e9f53/cursor.sh
mv cursor cursor.backup
mv cursor.sh cursor
  1. Replace WINUSERNAME by your own
  2. Give permissions to shell sudo chmod 777 fix-cursor, and refresh environment source ~/.zshrc or source ~/.bashrc
  3. When cursor was not work, fix-cursor can fix it.

https://gist.github.com/swayducky/8ba8f2db156c7f445d562cdc12c0ddb4

This's better than me.

x-ray-s avatar Sep 11 '24 12:09 x-ray-s

When VSCode or Cursor updates,cursor perhaps have some problem. Use the following script to resolve.

  1. cd /usr/local/sbin/, create a file, mine is fix-cursor
  2. paste code below
#! /bin/bash
win_cursor_path="/mnt/c/Users/WINUSERNAME/AppData/Local/Programs/cursor/resources/app/bin/"
cd $win_cursor_path
wget -O cursor.sh https://gist.githubusercontent.com/ddwang/0046da801bcb29d241869d37ad719394/raw/088836e0d946de07a82c245066ef07ddc35e9f53/cursor.sh
mv cursor cursor.backup
mv cursor.sh cursor
  1. Replace WINUSERNAME by your own
  2. Give permissions to shell sudo chmod 777 fix-cursor, and refresh environment source ~/.zshrc or source ~/.bashrc
  3. When cursor was not work, fix-cursor can fix it.

I got this error

--2024-09-14 05:11:28--  https://gist.githubusercontent.com/ddwang/0046da801bcb29d241869d37ad719394/raw/088836e0d946de07a82c245066ef07ddc35e9f53/cursor.sh
Resolving gist.githubusercontent.com (gist.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.111.133, ...
Connecting to gist.githubusercontent.com (gist.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2154 (2.1K) [text/plain]
Saving to: ‘cursor.sh’

cursor.sh                     100%[=================================================>]   2.10K  --.-KB/s    in 0.001s

2024-09-14 05:11:28 (4.02 MB/s) - ‘cursor.sh’ saved [2154/2154]

mv: cannot move 'cursor' to 'cursor.backup': Is a directory
mv: cannot move 'cursor.sh' to 'cursor': Is a directory

MediconcenVictor avatar Sep 13 '24 06:09 MediconcenVictor

@MediconcenVictor U can remove cursor, it is a folder in your system. cd /mnt/c/Users/WINUSERNAME/AppData/Local/Programs/cursor/resources/app/bin/" rm -rf cursor

x-ray-s avatar Sep 15 '24 08:09 x-ray-s

is this being worked on as it broke the CLI for vs code and cursor never worked... so it is a bit annoying that it broke another tool...

danmayer avatar Sep 17 '24 20:09 danmayer