ReasonJun

Cursor SSH 연결 에러 해결: "Failed to install the Cursor Server" 본문

Useful Lib

Cursor SSH 연결 에러 해결: "Failed to install the Cursor Server"

ReasonJun 2025. 7. 24. 01:32
728x90

문제 발생 : 

Cursor에서 AWS EC2로 원격 접속하려고 했더니 이런 에러가 떴다.

Connection to Cursor server failed: Failed to install the Cursor Server. Please check the logs for more details.

아니, SSH는 되는데 왜 Cursor만 작동을 하지 않았다. 

로그 확인

/usr/libexec/grepconf.sh: line 5: grep: command not found
/etc/profile.d/which2.sh: line 4: readlink: command not found
bash: bash: command not found
debug1: Exit status 127

grep도 없고, bash도 없다는 것을 알게되었다. AWS Instance에 직접 SSH로 접속해봤다.

$ ssh -i ~/.ssh/woori-kubernetes.pem ec2-user@ec2-43-203-153-38.ap-northeast-2.compute.amazonaws.com
-bash: grep: command not found
-bash: readlink: command not found
-bash: basename: command not found

역시나 기본 명령어들을 못 찾고 있었다. 

문제 원인

PATH를 확인해보니 범인을 찾았다.

/usr/local/cuda-12.2/bin${PATH:+:${PATH}}

 CUDA 설정하면서 실수로 이상한 구문을 넣어놨다. 변수 확장이 제대로 안 되어서 시스템이 명령어를 못 찾는 거였다.

해결

1단계: .bash_profile 수정하기

먼저 vi를 전체 경로로 실행한다 :

/usr/bin/vi ~/.bash_profile

파일이 열리면:

  1. i 키를 눌러서 입력 모드로 전환
  2. # User specific environment and startup programs 아래에 이 줄 추가:
    export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH
    
  3. ESC 키 누르고 :wq 입력해서 저장

2단계: .bashrc도 수정

Cursor는 가끔 non-interactive shell로 접속하기 때문에 .bashrc도 수정해야 한다:

/usr/bin/vi ~/.bashrc

파일 맨 끝에 같은 내용 추가:

  1. Shift + G로 파일 끝으로 이동
  2. o 키 눌러서 새 줄 만들기
  3. 똑같이 추가:
    export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH
    
  4. 저장하고 나오기 (ESC → :wq)

3단계: 설정 적용하고 확인

source ~/.bash_profile
source ~/.bashrc

# 이제 명령어가 제대로 작동하는지 확인
which grep
which bash
echo $PATH

4단계: Cursor에서 다시 접속

SSH 세션을 완전히 종료하고:

exit

Cursor에서 다시 Remote SSH 연결을 시도했다. 정상적으로 연결되는 것을 확인했다. 

 

정리

결국 PATH 설정이 꼬여서 생긴 문제였다. .bash_profile과 .bashrc 둘 다 수정해야 Cursor가 제대로 접속할 수 있다는 게 포인트인것 같다. 이 글이 같은 문제로 고생하는 누군가에게 도움이 되길 바란다. 

728x90
Comments