Raspberry Pi Visual Studio Code: Installing VS Code on Raspbian by Gus Sep 19, 2018 Updated Dec 03, 2019 GuidesIn this Raspberry Pi Visual Studio Code (VS Code) tutorial I go through all the steps to installing this handy code editor.If you’re using the Raspberry Pi as a desktop and want a decent program to edit and create code, then Visual Studio Code is perfect. It is feature packed and contains basically everything you will need to make your very own programs.I recommend using a Git service such a self-hosted Git, GitHub or even Gitlab. These software packages are not just great for version control but also making sure that your code is backed up and readily available.There are many other code editors that you can use on the Raspberry Pi. Each of the editors has their own pros and cons. I find VS Code one of the best that you can easily install on the Raspberry Pi.Note: Due to changes in Visual Studio Code, you can only install version 1.29 (Outdated). We will update this tutorial as soon as it is possible to install newer versions of VSC. EquipmentBelow are all the pieces of equipment that I made use of to do this Raspberry Pi VS Code tutorial.Recommended: Raspberry Pi 2 or 3 Micro SD Card Power Adapter Ethernet Cord (Recommended) or WiFi dongleOptional: Raspberry Pi Case Main Features of Visual Studio CodeMany features of Visual Studio Code makes it stand out from alternatives. One of the best parts is that it’s completely free and very customizable. Open Source & FreeAn exciting part of VS Code is that it is completely open source and you can view all the code on GitHub. It is registered under the MIT license allowing you flexibility if you wanted to fork and edit the code.You can also check the Raspberry Pi build on GitHub. These two Github’s are important if you wanted to check out what you’re about to install. Built-in GitThis feature is super handy if you use version control a lot. It works with Git and other SCM (Software Configuration Management) providers and allows you to review diffs, stages and commit files from within the editor. Debugging CapabilitiesYou can debug your code in the editor which helps reduce the amount you need to rely on print statement debugging. You can debug your apps using breakpoints, call stacks and an interactive console. Extensible and CustomizableOne of the coolest features of Visual Studio Code is how extensible. For example, you can install new language packs, themes, debuggers, formatting tools, and so much more.All your extensions are in separate processes so that they won’t slow down the editor. Installing Visual Studio CodeJay or aka Headmelted provides builds of Visual Studio Code that can work on the less popular platforms. This range includes operating systems such as ChromeOS, Raspbian, Linux Mint, Fedora and more.The apt.sh script further down the page will typically add the required GPG keys for the package to install correctly. However, I have had issues with it working correctly. To install the correct GPG keys simply run the following command.wget https://packagecloud.io/headmelted/codebuilds/gpgkey -O - | sudo apt-key add -To install Visual Studio Code, you only need to run a straightforward command.curl -L https://raw.githubusercontent.com/headmelted/codebuilds/master/docs/installers/apt.sh | sudo bashOnce done you should be able to find the visual studio code under the accessories menu called Code-OSS.You can now start coding to hearts desire on the Raspberry Pi. You should realize quickly why Visual Studio Code has become a favorite amongst many avid programmers.I hope that this Raspberry Pi Visual Studio Code tutorial has shown you all the steps to setting up this code editor. If you have some thoughts, tips or anything else then please feel free to leave a comment below.Installing InfluxDB to the Raspberry PiHow to Upgrade Raspbian Jessie to Raspbian StretchArduino UV Sensor using the VEML6075Raspberry Pi OwnCloud: Your Own Personal Cloud StorageBuild your own Raspberry Pi Pirate RadioHow to Install Raspbian: A Simple Guide for Beginners Get tutorials delivered to your inbox weekly. Sign up »
for some reason, the 2nd step isn’t working for me. curl -L https://code.headmelted.com/installers/apt.sh | sudo bashthe error I get is “Ocurl: (6) could not resolve host: code.headmelted.com“Reply
Hi Renzo,It appears as if that code.headmelted.com is currently having DNS routing issues.We have updated the tutorial to point to the file directly from the github repository.Try running the following command instead curl -L https://raw.githubusercontent.com/headmelted/codebuilds/master/docs/installers/apt.sh | sudo bashCheers,Emmet
Just FYI – The latest (as of Summer 2019) insider-version of Visual Studio Code supports remotely connecting to a Raspberry Pi via plain SSH (and I also run it on Tinker Boards). This means your dev environment runs on your standard host (PC/Mac/…) while your files as well as execution environment are on the Pi. This is a bit of an early code but to me it looks very interesting.Reply
If you use ssh, you can connect your VS Code with the SFTP plugin.Better than coding on the pi 🙂Reply
But how to do that? I try to run it via ssh and enable the server, then connect to the server from my laptop, but it seems to be impossible. When I run it, it simply stops after a second
Hi,thanks a lot for this tutorial! I can install code-oss fine, but I cannot get it to start properly, it is just showing me an empty black screen. This behaviour happens when opening from the menu, opening from the terminal or by opening a (very simple) script.Would you have any tip about this?ThanksReply
Hi Ulu,A recent update seems to have made this happen.You can downgrade VS code by running the following command.sudo apt-get install code-oss=1.29.0-1539702286Mark it “on hold” so it doesn’t upgrade to the latest version automatically.sudo apt-mark hold code-ossTo remove the hold, just enter the following.sudo apt-mark unhold code-ossMultiple Github issues have been opened regarding this issue, so hopefully it will be fixed soon.
Wonderful, worked perfectly!!! It will help a lot my 9-year-old daughter learn coding. Thank you very very much!!!Reply