How to Set Up Visual Studio Code on Raspberry Pi (Local and Remote Guide)

How to Set Up Visual Studio Code on Raspberry Pi (Local and Remote Guide)

Aug 1, 2025

Raspberry Pi board next to the Visual Studio Code logo, illustrating how to run Visual Studio Code on Raspberry Pi.

Visual Studio Code on Raspberry Pi enables a modern development experience, especially compared to using basic text editors or terminal-only tools.

Why Use Visual Studio Code on Raspberry Pi?

Official Visual Studio Code logo used in Raspberry Pi development tutorials.

Working directly on the Pi using basic editors or terminal-only tools can be limiting, especially when handling larger codebases or requiring version control, debugging, and syntax support. If you're starting out, consider exploring Raspberry Pi Kits that come with compatible accessories and resources tailored for beginners.
VS Code brings modern development capabilities to Raspberry Pi without overwhelming its limited resources. It offers:

• Lightweight and Cross-Platform:
Visual Studio Code runs efficiently on devices with limited resources like Raspberry Pi, while maintaining full compatibility across Linux, Windows, and macOS environments.
• Extensive Extension Ecosystem:
Thousands of community-driven and official extensions are available to enhance support for languages, frameworks, version control, IoT protocols, and more.Our team also developed a walking robot that can dance, detect obstacles and more—see the full PiSloth robot tutorial to explore setup and programming.
• Flexible for All Skill Levels:
Whether you're just starting with Python scripts for GPIO or managing complex C/C++ applications with multiple dependencies, VS Code adapts to both entry-level and professional development workflows.

Benefits of Remote and Lightweight Development

In the world of IoT, efficient use of hardware resources is critical, especially when working with single-board computers like Raspberry Pi. Remote development using lightweight tools like Visual Studio Code offers a strategic advantage by offloading processing tasks and streamlining the development workflow.

• Preserve Raspberry Pi Resources:
Running a full development environment directly on the Pi can consume significant CPU and memory, impacting the performance of IoT services. By coding and compiling remotely—from a more powerful workstation—you keep the Raspberry Pi focused on its core tasks like sensor management, data processing, or edge communication.We use the Raspberry Pi expansion board known as SunFounder Robot HAT Series to connect motors and sensors for robot projects.
• Improved Speed and Usability:
Remote access through SSH or VS Code’s Remote Development extensions allows for a smoother experience, highlighting the benefits of remote development with Raspberry Pi in resource-constrained environments.Developers benefit from faster file navigation, better auto-completion, and reduced lag—especially important when working on complex projects or debugging hardware interactions.
• Cross-Device Flexibility:
Remote development enables seamless access to your Raspberry Pi projects from multiple machines, making remote development with Raspberry Pi ideal for distributed teams.whether you're working from a laptop, desktop, or even a cloud-based IDE. This flexibility supports collaborative environments, field testing, and distributed teams.

System Requirements

Hardware Requirements

For Local Installation (Running VS Code on the Pi):

• Recommended Model: Raspberry Pi 4 or 5
• RAM: Minimum 2 GB (4 GB or more recommended for larger projects)
• Storage: At least 16 GB microSD (Class 10 or UHS-1), or SSD via USB 3.0 or PCIE HAT
• Power Supply: Official Raspberry Pi power adapter. 5V 3A

For Remote Development (Running VS Code on a PC):

Raspberry Pi model with network access and SSH enabled (Raspberry Pi 3 or higher recommended). If you're not sure how to set it up, here's a guide on how to enable SSH on Raspberry Pi.
Stable LAN or Wi-Fi connection

Software Requirements

Raspberry Pi OS (32-bit or 64-bit), Debian-based Linux distributions, or Ubuntu Server for headless setups

Installation Options

Whether you're prototyping sensor-based systems or deploying automation scripts, a well-configured Raspberry Pi VS Code setup can streamline your workflow and enhance efficiency.Depending on your project requirements and available resources, you can choose between a local installation or a remote development approach.

Local Installation on Raspberry Pi (Running VS Code on the Device)

To install VS Code on Raspberry Pi, developers can use the official Microsoft repository to ensure access to stable and optimized ARM builds.For developers who prefer working directly on the Raspberry Pi, Visual Studio Code can be installed using the official Microsoft repository. This method ensures you get the latest stable updates optimized for ARM-based devices when you install VS Code on Raspberry Pi using Microsoft’s official repository.

Steps:
1.Add the Microsoft GPG Key and Repository:
1.wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
2.sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
3.sudo sh -c 'echo "deb [arch=arm64] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
2.Update Sources and Install VS Code:
1.sudo apt update
2.sudo apt install code

Terminal screenshot showing the command-line installation of Visual Studio Code on Raspberry Pi using apt

2.Select the desired version:
Ubuntu Server 25.04 LTS (64-bit) — the ideal Raspberry Pi Ubuntu server setup for
headless and IoT
workloads

3.Launch VS Code from the Application Menu or via terminal:

Raspberry Pi desktop menu showing Visual Studio Code under the Programming category.Visual Studio Code welcome screen displayed on Raspberry Pi desktop after successful installation.

Note: For optimal performance, a Raspberry Pi 4 or 5 with 4GB+ RAM is strongly recommended.

Remote Development from a PC (Offloading the IDE)

√ Option A: Remote - SSH Extension

1.Install Remote - SSH in VS Code on your PC.

Visual Studio Code Extensions Marketplace showing Remote - SSH extension for Raspberry Pi remote development.

• Configure the ~/.ssh/config file for easy access:
Host my-pi
HostName 192.168.1.x
User pi

• Connect: via Remote explorer icon.

VS Code Remote Explorer showing an active SSH connection to Raspberry Pi

This setup lets you work on files stored on the Pi with full access to VS Code features, including terminals, extensions, and debugging. To make your workflow even smoother, check out how to organize your Raspberry Pi project structure for better file management and maintainability.

√ Option B: Browser-Based Access with VS Code Server

For headless environments or web access:
1.Install with a simple script: curl -fsSL https://code-server.dev/install.sh | sh

Terminal output showing the installation process of code-server on Raspberry Pi for browser-based Visual Studio Code access.

2.Edit the configuration file and set your-pi-ip in “bind-addr” and copy your password.

Editing the code-server config.yaml file in nano on Raspberry Pi to set bind address, authentication, and password.

3.Run code-server
To have systemd start code-server now and restart on boot:
  sudo systemctl enable --now code-server@$USER
Or, if you don't want/need a background service you can run:
code-server
4.Access it via http://<your-pi-ip>:8080 on your browser.
Secure access with authentication and reverse proxy (e.g., Nginx) is highly recommended for production or remote access. You can follow this guide to secure your Raspberry Pi with Nginx reverse proxy for better protection and performance.

Code-server login page in a browser on Raspberry Pi, prompting for password configured in config.yaml.Code-server interface opened in browser on Raspberry Pi, providing a web-based Visual Studio Code environment.

Development Environment Setup for Raspberry Pi with Visual Studio Code

Enabling and Configuring SSH on Raspberry Pi

To enable remote development, SSH access must be active on the Raspberry Pi: https://www.sunfounder.com/blogs/news/mastering-remote-control-unlocking-the-power-of-ssh-with-raspberry-pi

Organizing Folder Structure for Projects

Maintaining a clean directory structure helps isolate different applications and manage dependencies, which is especially helpful in a Raspberry Pi VS Code setup to avoid cross-project conflicts.

VS Code connected to Raspberry Pi via SSH, displaying project files and requirements.txt in the editor.

• Keep code, logs, and configuration files separated
• Use README.md and Makefile or build.sh for reproducibility
• Apply .gitignore to exclude compiled files or logs

Recommended Visual Studio Code Extensions

Enhance your productivity with the following extensions, especially relevant for a Raspberry Pi VS Code setup focused on IoT development:

VS Code Extensions panel showing Remote - SSH and recommended extensions for Raspberry Pi remote development.

• Python
Full support for Python development, including linting and debugging tools.
• C/C++
Required for low-level programming, device drivers, or GPIO access via native code.
• Pylance / IntelliCode
Provides powerful code analysis, type checking, and smart IntelliSense for Python.
• PlatformIO IDE
An all-in-one embedded development ecosystem for IoT projects, compatible with ESP32, STM32, Arduino, and more.
• Remote - SSH
Seamlessly connect your local VS Code instance to Raspberry Pi for editing, running, and debugging code remotely.
• Docker
Manage containers directly within VS Code—useful for deploying containerized microservices or MQTT brokers on Raspberry Pi.

Troubleshooting
×VS Code Not Launching or Crashing (Local Installation)
Ensure you're using a Raspberry Pi 4 or 5 with 4GB+ RAM
Run from terminal to view errors: code-server
If you encounter issues after you install VS Code on Raspberry Pi, try running it from the terminal to view any error messages: code-server
Clear the cache/config:
rm -rf ~/.config/Code
Update the system and reinstall VS Code:
sudo apt update && sudo apt upgrade
sudo apt remove code
sudo apt install code


×SSH Connection Issues (Remote Development)
Make sure SSH is enabled on Raspberry Pi:
sudo systemctl enable ssh && sudo systemctl start ssh
Use ping <your-pi-ip> to verify network visibility, which is a common first step in remote development with Raspberry Pi.
Check the VS Code SSH logs: View → Output → Remote – SSH

VS Code Remote - SSH output log showing code-server running on Raspberry Pi

Conclusion

Visual Studio Code on Raspberry Pi empowers developers at all levels—from hobbyists to professionals—to build, test, and deploy code efficiently.
With options for both local installation and remote access, developers of all levels can take full advantage of VS Code’s rich features without overwhelming the Pi’s hardware. By following the setup steps, organizing your workspace, and installing the right extensions, you’ll unlock a seamless workflow tailored for modern Raspberry Pi projects.

Back to News Raspberry Pi Ubuntu Setup: Installation, Configuration, and Best Use Cases