By this step you should have a .snap
of your app that you wish to test from a Mac.
As snaps only run on Linux, you’ll need to use a virtualisation solution to accomplish this. There are many great products that fall into this category, and any that can run one of the snap-supported distributions will work fine if you have the time to set it up.
A faster, more lightweight solution is Multipass. This virtualisation product can download and set up a complete Linux environment for testing snaps in a couple of minutes.
To install Multipass, download the latest “Darwin” build from the project’s releases page.
Once installed, open a Terminal window and confirm Multipass is correctly configured:
multipass version
This will print out the installed versions of the multipass command and its supporting daemon. If an error message is returned instead, consult the Multipass project page for further assistance.
Next, create a Linux virtual machine to test snaps in:
multipass create -n snaps
Map the project directory containing the .snap
file into the virtual machine:
multipass mount -u $UID:1000 -g $GID:1000 $PWD snaps:$PWD
And install the snap by telling multipass to run snap install
inside the virtual machine:
multipass exec snaps -- sudo snap install --dangerous $PWD/*.snap
Your snap is now installed in the virtual machine. Connect to the virtual machine and list your installed snaps to confirm:
multipass connect snaps
snap list
You can now run your application from this shell environment. Type its name and hit return.
Debugging
If your application fails to launch or an error occurs, consult the contents of /var/log/syslog
for a possible explanation.
If no explanation can be found, ask for assistance on the Snapcraft Forum. Be sure to include any relevant details, such as the contents of log files and any error messages printed on the terminal.
Next steps
Congratulations, you have a working snap. Continue on to learn how to apply the right security model to your application and ready it for publication in the Snap Store.