Connect Visual Studio Code to FreeBSD remote servers

Change log

  • : Instructions updated for 2026. Rocky Linux is now the Linux base for FreeBSD. Manually installing node and npm on the FreeBSD remote eliminates the connection timeout.
  • : Initial publication.

Connecting Visual Studio Code to a FreeBSD server using the VSCode Remote SSH extension can fail with errors like Unsupported platform: FreeBSD or glibc-related issues. This happens because VSCode’s remote server requires Linux binaries that aren’t available by default on FreeBSD.

If you try and connect VSCode to a FreeBSD server over SSH, you may encounter connection issues, or you may get errors like:

  • Unsupported platform: FreeBSD
  • exitCode==35
  • Failed to parse remote port from server output
  • ssh child died, shutting down
  • The remote host may not meet VS Code Server's prerequisites for glibc and libstdc++

Luckily, getting VSCode connecting to FreeBSD remotes isn’t tough.

A breakdown of the issue

First, it’s important to know that Visual Studio Code’s Remote - SSH Extension is more than just a simple SSH plugin… it actually executes binaries on the remote server, which allows all the fancy VSCode functionality to work.

This plugin works without a hitch for many Linux clients. But when connecting to a FreeBSD server, you have to do a few things to get the environment in a compatible state for these pieces to work.

To fix this, you’ll enable FreeBSD’s Linux compatibility layer, install a supported Linux base, and add some supporting packages. This will provide the runtime environment VSCode expects, allowing the remote server to start successfully.

How to connect VSCode to a FreeBSD remote server

First, on the FreeBSD server, you’ll enable and start Linux compatibility mode.

sysrc linux_enable="YES"
service linux start

We’ll then install the Linux base and some supporting packages. Installing node and npm can help if the VSCode server has startup failures.

pkg install linux_base-rl9 node npm

# Older guides may have you install CentOS 7, which is EOL as of 2024
# pkg install linux_base-c7

Back on your local computer running VSCode, edit .ssh/config and add these lines for the FreeBSD server’s entry:

Host bsd-web01
  Hostname bsd-web01.example.net
  RemoteCommand /compat/linux/usr/bin/bash
  RequestTTY force

Finally, find the Enable Remote Command setting in VSCode and enable it.

A screenshot showing a setting in Visual Studio Code of the 'Enable Remote Command' checkbox in an enabled state.

Voila! Now you can connect VSCode to FreeBSD. You’ll now be able to interact with the FreeBSD remote just like it was a Linux host, with all the helpful functionality in VSCode that you’re used to.

It took a long time to figure this one out. Credit to Mateusz Kwiatkowski and Oliver Giersch for the helpful comments I stumbled upon which explained the missing parts of this process.

Troubleshooting

Unsupported platform: FreeBSD

  • Ensure Linux compatibility is enabled and /compat/linux/usr/bin/bash exists.

exitCode==35 / ssh child died (VSCode Remote SSH error)

  • Usually indicates the VSCode remote server failed to start due to missing dependencies.
  • Ensure that your .ssh/config file is updated to match the above recommendation, and then activate the Enable Remote Command setting in VSCode.

glibc / libstdc++ errors

  • Make sure you’re using linux_base-rl9, which provides newer libraries required by VSCode.