VSCode

VSCode enables direct file editing on the HPC cluster through SSH connectivity.

Prerequisites

  • Updated VSCode installation

  • SSH client (built into Mac/Linux)

Setup

1. Create SSH Config

On your local machine, create/edit ~/.ssh/config:

mkdir -p ~/.ssh
touch ~/.ssh/config
chmod 700 ~/.ssh
chmod 600 ~/.ssh/config

2. Add Cluster Entry

Add to ~/.ssh/config:

Host hpc
    Hostname login.hpc.caltech.edu
    User yourusername
    ControlMaster auto
    ControlPath ~/.ssh/control:%h:%p:%r

3. Test SSH Connection

ssh hpc

Verify you can connect with password and Duo authentication.

4. Install Remote SSH Extension

In VSCode:

  1. Open Extensions (Cmd+Shift+X / Ctrl+Shift+X)

  2. Search for “remote-ssh”

  3. Install Remote - SSH by Microsoft

5. Connect

  1. Open Command Palette (Cmd+Shift+P / Ctrl+Shift+P)

  2. Type “Remote-SSH: Connect to Host”

  3. Select hpc from the list

  4. Enter password and complete Duo authentication

First Connection

VSCode server installs to your home directory on first connection.

Warning

Ensure sufficient home directory space (~500 MB) or installation will fail.

Advanced: Direct Compute Node Connection

A community script enables SSH/VSCode connection directly to allocated compute nodes:

https://gist.github.com/haakon-e/e444972b99a5cd885ef6b29c86cb388e

Note

Issues related to tunneling and/or VSCode server are not supported by Resnick HPC staff.

Troubleshooting

Terminal Launch Failure (forkpty error)

On the cluster, rename the VSCode server directory:

mv ~/.vscode-server ~/.vscode-server-backup

Then reconnect from VSCode.

Connection Timeout

  • Check VPN connection

  • Verify SSH config is correct

  • Try connecting via terminal first: ssh hpc

Extensions Not Working

Some extensions require server-side installation. Use the Extensions panel to install on the remote host.