Let’s learn to install Visual Studio Code on Arch Linux. Microsoft Visual Studio Code has become one of the most used text editor and IDE for developers. It is a very powerful IDE with support for almost all languages through thousands of plugins. It is also highly customizable along with the cross-platform support on different operating systems.
But this VSCode is a proprietary software not available in the official repositories, which means we cannot just install it using Pacman. However, the VS Code installation is quite simple and In this tutorial, I will show you how to install, run and use VS Code on Arch and Arch Based Linux distributions like Endeavor OS, Manjaro Linux and Garuda.
Code in the AUR
The Visual Studio Code can be downloaded from the AUR (Arch User Repository). The AUR offers two different versions of VSCode packages besides the official Microsoft build. These packages, namely – code and vscodium are the alternatives of Visual Studio Code on Arch.
They are licensed under the MIT license and is built on the same open-sourced libraries from which the official VS Code is built. The AUR also contains the development versions of all these binaries. In this article, we will be focusing mainly on installing the Microsoft packaged Visual Studio Code. Instructions to install open-source and development versions are listed at the end of the article.
Installing VS Code on Arch
There are two options for installing any application from AUR. We can either download the source code and build it from source manually, or we can take help of AUR helpers like paru and yay to install the program quickly. We will be going through both the ways in which we can install VS-Code.
1. Using AUR Helper
With paru/yay you can install vs-code with just one line:
# If you are using yay, just replace paru with yay. paru -S visual-studio-code-bin
2. Building VS Code from Source on Arch
The other option is to download the build the source code and build it from there manually. For this purpose, we need some extra tools – git (for cloning the source code) and base-devel (for installing the programs required to build the application from source). To install these packages, use the following command:
sudo pacman -S git base-devel
Downloading the package source code
Clone the VS-Code stable repository from the AUR using the command:
git clone https://aur.archlinux.org/visual-studio-code-bin.git
Build the package
To build the package from source, enter the package directory and use the following command:
cd visual-studio-code-bin makepkg -si
The makepkg enters the chroot environment to install this application along with its dependencies (for building and running the package). You will be prompted for the root password for making the final changes. After the installation, you can just type code in the terminal to launch this application.
Installing other versions of VS Code on Arch Linux
If you are a pro-open-source person, or you just want to be on the bleeding edge, you might be tempted to install the insider’s version or the open-source versions. The installation process is quite similar to that of the Microsoft stable VS Code on Arch. The stable community-driven built – code is available in the official repositories, so you can install it just by using Pacman.
For other binaries, you can just replace the visual-studio-code-bin with the repository of your choice. For example, if you want to install the development branch of code which is code-git, you can just use this command:
paru -S code-git
Note: The development and stable versions conflict with each other. So you cannot normally have two different versions/build of VS Code on the same machine concurrently.
In order to run Visual Studio Code, you can just open your Application grid/Menu and from there you can just click on the respective icon. If you face any issues regarding the code editor, its extensions, ssh etc. on any arch-based distribution, then you can check out the Arch Wiki common issues in Visual Studio Code.