In this post, we will explore how to install and configure Visual Studio Code (VS Code) on a Raspberry Pi.
Visual Studio Code is a highly popular and versatile source code editor that provides a powerful development experience, with support for multiple programming languages and development tools.
We will go through the necessary steps to install VS Code on a Raspberry Pi, from preparing the system to basic configuration so you can start coding right away.
What is Visual Studio Code
Visual Studio Code (VS Code) is a free and open-source source code editor developed by Microsoft. It offers advanced features such as:
- Syntax highlighting: Support for a wide range of programming languages.
- Extensions: A vast library of extensions to enhance the editor’s functionality.
- Integrated debugging: Powerful debugging tools for a variety of languages.
- Version control: Integration with Git and other version control systems.
If you want to know more about VSCode, here’s a little entry
If you want to learn more about What is Visual Studio Code
check the Introduction to Programming Course read more
Prerequisites
Before starting the installation, make sure your Raspberry Pi meets the following requirements:
- Recommended model: Raspberry Pi 3 or 4 for optimal performance. Although VS Code can run on older models, the experience may be less smooth.
- Operating system: Raspberry Pi OS (formerly Raspbian) based on Debian.
- Disk space: Ensure you have enough disk space, as VS Code and its extensions can consume a significant amount of storage.
Installing Visual Studio Code
Before installing any new software, it’s a good practice to make sure your system is up to date. We run the following commands in the terminal:
sudo apt update
sudo apt upgrade
Microsoft provides an official version of VS Code for ARM, which is compatible with Raspberry Pi. To install it, we simply need to run:
sudo apt install code
And when we want to update it, we can do so with,
sudo apt upgrade code
Starting Visual Studio Code
After installation, we can start VS Code from the application menu or by running the following command in the terminal:
code
Installing Extensions
VS Code has a rich selection of extensions to enhance productivity. Some recommended extensions for developers on Raspberry Pi include:
- Python: For development support in Python.
- C/C++: For programming in C and C++.
- Remote - SSH: For remote development via SSH.
To install an extension, follow these steps:
- Open the extensions panel by pressing
Ctrl+Shift+X
or clicking on the extensions icon in the sidebar. - Search for the extension you want to install (for example, “Python”).
- Click “Install” to add the extension to your development environment.
Using the Integrated Terminal
VS Code includes an integrated terminal that is very useful for running commands and scripts directly from the editor. To open the terminal, use the shortcut Ctrl+ñ
or select “Terminal” from the top menu.