On Windows machines, the application MobaXterm is a valuable tool for computing on virtual machines and working through SSH clients. David Gold’s blog post walks through the installation and use of this app, which works well in Windows environments.
Working remotely on my Mac laptop, I have been struggling to achieve the same workflow as in the office, with a Windows machine. Unfortunately, MobaXterm is not available for download on Mac OS. Looking for alternatives, I discovered that using VS Code with the “Remote – SSH” extension is a great replacement with significant advantages to MobaXterm, as it an SSH client interface and code editor in one.
Here’s how you can set up a remote session on Mac (and Windows) using VS Code:
- Install the VS Code application here. For installation help and a brief overview of the app, check out this video.
- With VS Code opened, go to View -> Extensions, and search “Remote – SSH.” Click on the extension and press the green “Install” button. You should see the message “This extension is enabled globally” appear. Check out this extension’s description below (I’ll run through the basics in this post).
- On the bottom left of your screen, there should be a small green box with two opposite pointing arrow heads. Click this.
- Choose the first pop-up option “Remote-SSH: Connect to host…” and then select “Add New SSH Host…”.
- Here, enter your remote SSH username@serverid (here at Cornell, this would be email@example.com to connect to our remote computing cluster, the Cube).
- In the same pop-up window, click the remote server that you just added. A new window will open and prompt you to enter your password for the server.
- Now, you in are in your remote SSH environment. Click “Open folder…” and select “OK” to see your remote directory on the left. You can navigate through these files in your remote machine the same way as MobaXterm. Click View -> Terminal to see your SSH command line on the bottom of the screen (here’s where you can actually run the programs on your cluster).
Now using VS Code, you can install other extensions to aid in code editing in different languages (here’s an article with a few good ones for various uses). This environment has the same functionality as MobaXterm, without having to switch applications for editing code. Run your cluster programs in the terminal window and edit the code in the main VS Code editor!