Select Page

Introduction

Snap is a third-party package manager for your Linux distribution that has its own repository, maintained by Canonical – the creators of Ubuntu. Snap is easy to use and is becoming more and more popular over time. The best thing about snap is that it installs applications in their own containers, which means that their dependencies are not used across applications. This does mean that the programs will take up more disk space, but they’ll also be a lot easier to install, manage and uninstall without breaking dependencies for other applications.

However, many users have have been unable to use snap for install other packages, and they get the following error message:

snap: command not found

The fix to this is actually quite simple, and most of the time, a slight change in snap’s package name when trying to install it might as well be the only cause for the error message. Let me explain.


Is snap installed in your machine?

The first thing you should ensure before anything else is whether snap is installed in your machine. If you’re just starting out on Linux, I understand your pain very well, as I’ve been there too and am a Windows convert myself (though I’ve started using MacOS recently). It is not so uncommon to expect every command to work out of the box, without having them installed. While there is some truth to this, as many distributions of Linux such as Ubuntu actually come shipped with snap installed by default. But in most other cases, it might not be a thing. 


Are you using the right package name for snap?

One other common misconception when trying to install the snap package is using the wrong name for the package. That is, when you want to install snap, you actually need to use snapd instead of just snap (you’ll know what I mean in the very next section). So what’s this new thing called snapd? Snapd is actually just a “snap daemon”, which means that it’s a service that runs in the background, and without it, snaps won’t work. But like everyone else, I don’t know why they couldn’t name their package to be just “snap”, as the command you’d be running is only snap too. I mean, there isn’t any other package with the name snap in any linux repositories, is there?


Install snap in your Linux machine

Enough fuss for now. Let’s get down to the actual business. To fix the error, what you need to do is install the snap package in your Linux distribution. Now the problem is, the command to install it will differ from person to person, as not everyone is using the same distribution (Linux actually has more than 600 distributions as of now). Luckily, most of these distributions are based on some common distributions. 

Here are the commands you’d use on the most commonly used Linux distributions to install snap (if your distribution is not listed below, you need to first check which package manager your distribution uses. Your distribution might as well be a fork of at least one of the distributions mentioned below):

Arch Linux

$ sudo pacman -Syu
$ sudo pacman -S snapd

Ubuntu

$ sudo apt-get update
$ sudo apt-get install snapd

Debian

$ sudo apt-get update
$ sudo apt-get install snapd

Fedora

$ sudo yum makecache
$ sudo yum install snapd

RedHat

$ sudo dnf makecache
$ sudo dnf install snapd

CentOS

$ sudo dnf makecache
$ sudo dnf install snapd

Kali Linux

$ sudo apt-get update
$ sudo apt-get install snapd

You should’ve noticed the “d” at the end of the package name by now, and if you’ve previously tried to install the package with only the name “snap”, this is where you had gone wrong. The first line of command is crucial as it updates your system repositories. The second line of command installed the snapd package (which contains the snap command), in your Linux machine.


Start the snapd service

Once you’ve installed snap, you might not be able to run the command just yet, or even if you just did, you’d not be able to install any other programs. This is because you first need to restart your terminal (it’s best if you restart your system too) for snap’s path to be set properly, and for the snapd daemon to start running. In certain occasions, the snapd daemon may not start by itself even after you restart it. To fix this, run the following set of commands, one after the other:

$ sudo systemctl enable enable snapd.service
$ sudo systemctl start enable snapd.service

You should now be able to properly run the snap command and install your favourite programs in your Linux machine!


Alternatives to Snap

If you’re unhappy with snap commands, for whatever reason it might be, worry not as we have a few alternatives for you that’re worth considering. Some of them are a bit new to the game, so they might have fewer packages than the ever-growing Snapcraft, but they’re still getting better over time!

Some of the best Alternatives to Snap are:

  • Flathub (Flatpak)
  • Appimage
  • Souk (based on Flatpak)

Both Appimages and Flathub are quite on par with Snap, and in many cases even better than Snap. You can learn more about their features and advantages from their official websites, if you may!