Setting Up VS Code and Remote Linux Development (macOS & Windows)

This guide walks through three essential steps for modern software development:

  1. Installing and configuring Visual Studio Code on macOS and Windows
  2. Setting up SSH access to a Linux (Ubuntu) system using SSH keys
  3. Remotely editing files on the Linux system directly from VS Code

This is the workflow we’ll use throughout the course.

A Linux system is available for you to use at IP address 10.192.145.179.


Part 1: Installing Visual Studio Code (VS Code)

macOS

  1. Go to:
    https://code.visualstudio.com/
  2. Download the macOS version.
  3. Open the downloaded .zip file and drag Visual Studio Code into the Applications folder.
  4. Launch VS Code from Applications.
  5. (Recommended) Enable the code command:
    • Press Cmd–Shift–P
    • Type: Shell Command: Install 'code' command in PATH
    • Press Enter

This allows you to launch VS Code from the terminal using:

code .

Windows

  1. Go to:
    https://code.visualstudio.com/
  2. Download the Windows installer.
  3. Run the installer and accept the defaults.
  4. When prompted, check the box:
    • “Add to PATH”
  5. Launch VS Code from the Start Menu.

Part 2: Logging into a Linux (Ubuntu) System Using SSH

You will connect to a remote Linux system using SSH (Secure Shell).

Step 1: Open a terminal

  • macOS: Open Terminal
  • Windows: Open PowerShell (or Windows Terminal)

Step 2: Generate an SSH key (do this once)

Run:

ssh-keygen -t ed25519

When prompted:

  • Press Enter to accept the default file location
  • Press Enter again for no passphrase (or set one if you prefer)

This creates:

  • A private key (keep secret)
  • A public key (safe to share)

Step 3: Copy your public key to the Linux server

Assuming:

  • Your Linux username is username
  • Your server is 10.192.145.179

Run:

ssh-copy-id username@server.example.edu

If ssh-copy-id is not available (some Windows systems), do this instead:

cat ~/.ssh/id_ed25519.pub

Copy the output, then log into the server with:

ssh username@server.example.edu

On the server:

mkdir -p ~/.ssh
nano ~/.ssh/authorized_keys

Paste the key, save, and exit.


Step 4: Test login

From your local machine:

ssh username@server.example.edu

You should now log in without a password.


Part 3: Remote Editing on Linux Using VS Code

VS Code can edit files directly on the remote Linux system using SSH.

Step 1: Install the Remote SSH extension

  1. Open VS Code
  2. Click the Extensions icon (left sidebar)
  3. Search for:Remote - SSH
  4. Install it (by Microsoft)

Step 2: Connect to the Linux server

  1. Press Cmd–Shift–P (macOS) or Ctrl–Shift–P (Windows)
  2. Type:Remote-SSH: Connect to Host
  3. Choose Add New SSH Host
  4. Enter:ssh username@server.example.edu
  5. Select the default SSH config file
  6. Confirm the connection

VS Code will open a new window connected to the Linux system.


Step 3: Open and edit files remotely

Once connected:

  1. Click File → Open Folder
  2. Choose a directory on the Linux machine (e.g., ~/projects)
  3. Open a terminal inside VS Code:
    • View → Terminal

You are now:

  • Editing files on Linux
  • Running Linux commands
  • Compiling and running programs on the remote machine

All edits happen remotely, but feel like local editing.


Common Commands (Run in VS Code Terminal)

ls
cd project_name
make
./program_name
git status
git pull
git push

Troubleshooting Tips

  • If SSH fails, verify:
    • Correct username
    • Correct server name
    • Your public key is in ~/.ssh/authorized_keys on the server
  • If VS Code hangs on first connect:
    • Be patient — it installs a small server on Linux the first time
  • If VS Code won’t reconnect:
    • Run ssh username@server.example.edu manually to test SSH first

Summary

By the end of this setup, you should be able to:

  • Use VS Code on your laptop
  • Log into a Linux server securely with SSH keys
  • Edit, build, and run programs on Linux directly from VS Code

This is the same workflow used by professional software engineers working on remote systems.


Scroll to Top