How to install Visual Studio Code on ArchLinux

In this article we are going to learn how to install Visual Studio Code also known as (VScode) on ArchLinux.

Visual Studio Code is a lightweight source code editor which runs on desktops and is available to all operating systems out there. It comes with built-in Javascript, Node.js, and Typescript. One can do programming for almost all languages with ease with Visual Studio Code. The languages supported are, Go, PHP, C++, C#, Java, Python, and also Microsoft.NET.

Why do we like Visual Studio Code?

The reason VS code is such a nice tool is because of the following reasons:

  • It is available on all operating systems so it does not limit one on where to run the VS code, you can easily hit the ground running.
  • Vscode has a rich build-in developer tooling for example IntelliSense code completion and debugging which become handy when you don not know the complete code snippet. IT acts a guide and also lessen time to code.
  • VScode can be customized to suit your needs. You can customize every feature the way you wish and also you can add third party extensions easily.
  • VScode is an open source project. So it means you can contribute to the project development, also it means that you have a bigger community where you can ask questions whenever you are faced with problem.
  • VScode is built for the web. It includes great tools for web development such React JSx, JSON, SCSS,CSS, HTML and Less.

Prerequisites

  • Have ArchLinux Distro
  • Have basic understanding of terminal
  • Have a user with sudo privileges.

There are two ways to install Visual Studio Code

  • Installing via AUR packages
  • Installing via Snap packages

Table of Contents

  1. Update system repositories
  2. Install Visual Studio Code from AUR or Snap
  3. Conclusion

Installing Visual Studio Code 6.2 via AUR Packages

The Arch User Repository (AUR) is a community-driven repository for Arch users. It contains package descriptions (PKGBUILDs) that allow you to compile a package from the source with makepkg and then install it via Pacman.

Steps to follow while installing from AUR packages

  1. Acquire the build files including PKGBUILDs
  2. Verify that the PKGBUILDs are not malicious
  3. Run makepkg in the directory where files are saved.
  4. Run pacman -U package to install the package.

Before installing ensure you install necessary tools including base-devel.

Install Visual Studio Code

First, install the base-devel so that it can install all the required packages into the system.

$ sudo pacman -S git base-devel

Sample output

warning: git-2.34.1-1 is up to date -- reinstalling
:: There are 24 members in group base-devel:
:: Repository core
   1) autoconf  2) automake  3) binutils  4) bison  5) fakeroot  6) file
   7) findutils  8) flex  9) gawk  10) gcc  11) gettext  12) grep  13) groff
   14) gzip  15) libtool  16) m4  17) make  18) pacman  19) patch  20) pkgconf
   21) sed  22) sudo  23) texinfo  24) which

To begin our installation, download the package from AUR package with the following command:

$ git clone https://aur.archlinux.org/visual-studio-code-bin

Sample output

 Cloning into 'visual-studio-code-bin'...
remote: Enumerating objects: 530, done.
remote: Counting objects: 100% (530/530), done.
remote: Compressing objects: 100% (365/365), done.
remote: Total 530 (delta 188), reused 544 (delta 182), pack-reused 0
Receiving objects: 100% (530/530), 215.78 KiB | 346.00 KiB/s, done.
Resolving deltas: 100% (188/188), done.

Then you can cd into the directory you extracted the Visual Studio Code.

Now we can run makepkg. This will download the code, compile and package it accordingly.

$ makepkg -si

You will get the following output.

==> Making package: visual-studio-code-bin 1.62.3-1 (Tue 30 Nov 2021 03:31:22 PM UTC)
==> Checking runtime dependencies...
==> Installing missing dependencies...
[sudo] password for nextgentips: 
resolving dependencies...
looking for conflicting packages...
warning: dependency cycle detected:
warning: harfbuzz will be installed before its freetype2 dependency
warning: dependency cycle detected:
warning: libglvnd will be installed before its mesa dependency
.....

Installing Visual Studio Code 6.2 via snap packages

The first thing to do is to clone the git repository. Use the following command

$ git clone https://aur.archlinux.org/snapd.git

Sample output will be as follows

Cloning into 'snapd'...
remote: Enumerating objects: 562, done.
remote: Counting objects: 100% (562/562), done.
remote: Compressing objects: 100% (375/375), done.
remote: Total 562 (delta 188), reused 553 (delta 182), pack-reused 0
Receiving objects: 100% (562/562), 215.78 KiB | 346.00 KiB/s, done.
Resolving deltas: 100% (188/188), done.

Then you need to cd into snapd package in order to install the Visual Studio Code 6.2

$ cd snapd

When inside snapd, run the following code to install the vscode.

$ makepkg -si
==> Making package: visual-studio-code-bin 1.62.3-1 (Tue 30 Nov 2021 03:31:22 PM UTC)
==> Checking runtime dependencies...
==> Installing missing dependencies...

To open Visual studio code type code in your terminal and it will open the VScode

$ code

Conclusion

You have successfully installed Visual Studio Code. I hope you have learned something. You can consult Arch Wiki documentation.

About Mason Kipward

I am a technology enthusiast who loves to share gained knowledge through offering daily tips as a way of empowering others. I am fan of Linux and all other things open source.
View all posts by Mason Kipward →

Leave a Reply

Your email address will not be published. Required fields are marked *