Snapcraft installation and setup

Snapcraft is a command line tool that allows developers to build and publish their applications as snaps.

Snapcraft can be installed and used on any supported system, including various Linux distributions as well as the macOS and Windows operating systems.

Installation from the Snap Store

On Linux distributions with snap support, the easiest way to install snapcraft is via its snap:

sudo snap install snapcraft --classic

The --classic argument is required because snapcraft uses classic confinement.

Repository version or snap

A Linux system may have both the repository and snap version of Snapcraft installed at the same time. Typically, the snap version will be the preferred one, and usually the first listed command in the user’s shell command path.

The which command can be used to check which version of snapcraft is run by default:

$ which snapcraft
/snap/bin/snapcraft

Snapcraft build providers

By default, Snapcraft relies on a build provider to create an isolated build environment inside which applications can be built and packaged as snaps without changing the host system. Two build providers are supported:

  • Multipass, which creates virtual machine build instances. It cannot be reliably used on platforms that do not support nested virtualization. For instance, Multipass will most likely not run inside a virtual machine itself.
  • LXD, which creates container image build instances. It can be used inside virtual machines.

See Build providers for further details on configuring and using either Multipass or LXD, and for options that don’t require a built provider.

I would not go on at this length about the advantages of the snap version of snapcraft; just tell the reader to make sure they’re using the snap version and leave it at that.

Regarding the snapcraft backend, does snapcraft really require a backend if you’re simply building in destructive mode on your host?

Thanks - this was a relic of an older time, I think. Also, I’ve updated the backend text to reference our build provider documentation. This page should probably be deprecated as I don’t think it’s terribly useful.