Search Docs by Keyword

Table of Contents

Cursor Remote Development via SSH and Tunnel

This document provides the necessary steps needed to setup a remote connection between Cursor on your device and the Cannon cluster using: SSH and Tunnel. These options could be used to carry out the remote development work on the cluster with seamless integration of your local environment and cluster resources.

Prerequisites

  1. Recent version of Cursor downloaded and installed for your local machine
  2. Remote SSH extension installed, if not already present by default

Establishing Connection

The Remote SSH and Tunnel capabilities of Cursor are similar to that of VSCode. For Remote SSH, the same config file that is used for VSCode is applicable for Cursor.  Hence, in order to establish connection between the cluster and your local device using Cursor, the same steps and recommendation must be followed as mentioned in VSCode Remote Development via SSH and Tunnel. However, below we note some of the differences that should be kept in mind while establishing connection using Cursor.

Remote – Tunnel 

Cursor applies the same concept of remote tunnel as VSCode. In order to get started on establishing a tunnel interactively, start with following the steps mentioned for VSCode interactive tunnel session with the exception of downloading the corresponding tarball for Cursor either from here or here.

  1. Download the Cursor CLI on your remote machine:
    curl -Lk ‘https://api2.cursor.sh/updates/download-latest?os=cli-alpine-x64’ --output cursor_cli.tar.gz
  2. Extract the CLI: tar -xzf cursor_cli.tar.gz
  3. Create a secure tunnel: ./cursor tunnel

Similarly, for launching remote tunnel as an sbatch job, follow the instructions for VSCode sbatch tunnel session with the exception of using the cursor.job script instead:

#!/bin/bash                                                                                                                                                                                                                                          

#SBATCH -p test         # partition. Remember to change to a desired partition                                                                                                                                                                       
#SBATCH --mem=4g        # memory in GB                                                                                                                                                                                                               
#SBATCH --time=04:00:00 # time in HH:MM:SS                                                                                                                                                                                                           
#SBATCH -c 1            # number of cores                                                                                                                                                                                                            

set -o errexit -o nounset -o pipefail
MY_SCRATCH=$(TMPDIR=/scratch mktemp -d)
echo $MY_SCRATCH

#Obtain the tarball and untar it in $MY_SCRATCH location to obtain the                                                                                                                                                                               
#executable, code, and run it using the provider of your choice                                                                                                                                                                                      
curl -Lk 'https://api2.cursor.sh/updates/download-latest?os=cli-alpine-x64' | tar -C $MY_SCRATCH -xzf -

#VSCODE_CLI_DISABLE_KEYCHAIN_ENCRYPT=1 $MY_SCRATCH/code tunnel user login --provider github           
CURSOR_CLI_DISABLE_KEYCHAIN_ENCRYPT=1 $MY_SCRATCH/cursor tunnel user login --provider microsoft

#Accept the license terms & launch the tunnel                                                                                                                                                                                                        
$MY_SCRATCH/cursor tunnel --accept-server-license-terms --name cursortunnel

Note: Our tests have shown that unlike VSCode, Cursor does not support opening an active tunnel using a browser. 

Remote – SSH

This will follow the exact same prescription as that for VSCode SSH. The only difference is Cursor’s GUI. Unlike VSCode, Cursor doesn’t have an “Activity Bar” on the left panel. Hence, one can launch Remote SSH in one of the two ways shown below.

One approach to launch the Remote SSH interface. 

Another way to bring up the Remote Explorer interface.

Troubleshooting

As for resolving issues related to launching Cursor on the cluster, refer to the VSCode troubleshooting section.

© The President and Fellows of Harvard College.
Except where otherwise noted, this content is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license.