VS Code Remote Development with Pi
Use VS Code Remote SSH to develop directly on your Raspberry Pi from your laptop. Covers setup, extensions, and performance tips.
Introduction
VS Code Remote-SSH lets you edit code on your Raspberry Pi directly from your laptop as if it were local. You get syntax highlighting, debugging, and terminal integration—all with the Pi's environment. This beats SSH terminals for serious development work.
Prerequisites
- VS Code on your laptop (Windows, Mac, or Linux)
- Raspberry Pi 4 or 5 with Raspberry Pi OS
- SSH access to your Pi
- SSH keys configured (passwordless login)
Step 1 — Set Up SSH Keys on Your Pi
Generate SSH keys on your Pi if you haven't:
ssh-keygen -t ed25519 -C "pi@raspberry" -f ~/.ssh/id_ed25519 -N ""
On your laptop, add your Pi to .ssh/config:
Host my-pi
HostName 192.168.1.50
User pi
IdentityFile ~/.ssh/id_ed25519
StrictHostKeyChecking no
Test the connection:
ssh my-pi
If it connects without a password prompt, you're ready.
Step 2 — Install Remote-SSH Extension
Open VS Code and search for "Remote - SSH" in Extensions (by Microsoft). Click Install.
You'll see a new Remote Explorer icon in the sidebar (the computer icon). Click it.
Step 3 — Connect to Your Pi
In the Remote Explorer, click the "+" button next to SSH Targets. Enter your Pi's hostname or IP:
pi@192.168.1.50
Pick your .ssh/config file or let it auto-detect. VS Code connects and installs the remote server on your Pi (~150MB, takes 2-3 minutes on first run).
Click "Connect in Current Window" and authenticate.
Step 4 — Open a Folder on Your Pi
After connecting, open a folder on the Pi. Click File → Open Folder and browse to /home/pi/projects or wherever your code lives.
VS Code now treats this as your workspace. All your terminals run on the Pi.
Step 5 — Install Extensions Remotely
Extensions installed locally don't work remotely. In the Extensions panel, you'll see an "Install in SSH: my-pi" button for each extension. Install what you need:
- Python (for Python development)
- Docker (for container work)
- Git Graph (version control visualization)
These run on the Pi and use its resources. Check memory usage:
free -h
Step 6 — Port Forwarding for Web Apps
Developing a web service? Forward the Pi's port to your laptop:
In VS Code, open the Ports panel (bottom right). Click "Forward a Port" and enter the port your app runs on (e.g., 3000, 5000, 8000).
Your laptop now reaches http://localhost:3000, which tunnels to the Pi. Perfect for testing without exposing the Pi publicly.
Performance Tips
Disable heavy extensions remotely: Language servers and formatters run on the Pi. Disable Copilot, IntelliCode, and heavy linters if your Pi is slow.
Use Pi 4 or 5 with 4GB+ RAM: Anything less and VS Code is sluggish.
SSH over better networks: Laggy WiFi makes remote development frustrating. Ethernet is ideal.
Monitor resource usage:
watch -n 1 free -h
On Pi 4 (4GB RAM), VS Code remote uses 200-300MB.
Alternative: code-server (VS Code in Browser)
If SSH remote feels slow or you want to access VS Code from multiple devices, try code-server:
curl -fsSL https://code-server.dev/install.sh | sh
code-server --bind-addr 0.0.0.0:8080
Then visit http://your-pi-ip:8080 from any device. It's lighter weight and works over HTTP, but less polished than Remote-SSH.
Troubleshooting
Cannot connect: Verify SSH works manually first: ssh -v pi@your-ip. Check firewall and SSH service running: sudo systemctl status ssh
Extensions won't install: Insufficient disk space on Pi. Check: df -h. Clean old build artifacts if needed.
Terminal slow or unresponsive: Your SSH connection is laggy. Try wired Ethernet or check router/WiFi signal.
High CPU/memory from VS Code: Disable auto-formatting and language servers. In Settings → Remote [SSH], disable "Format On Save" and heavy extensions.
VS Code Remote-SSH closes the gap between laptop comfort and Pi hardware reality. Pair it with Docker on the Pi for a true development homelab.
Summary
VS Code Remote-SSH turns your Raspberry Pi into a proper development machine without the overhead of running an IDE on the Pi itself. You get the full VS Code experience with the Pi's filesystem and tools — the best of both worlds.