Ruby for non-Rubyists with Snap

Written by Lorna Jane - - Aggregated on Monday October 7, 2019
Tags: tech, ruby, snap, ubuntu

I'm an Ubuntu user and I enjoy most server-side scripting languages but I haven't done much Ruby and I never get the feeling that Ruby is pleased to see me when I do. Something is always out of date or has an incompatible dependency or ... and since I don't use it regularly, I don't have the familiarity that enables me to easily debug these things with other platforms.

I've been using the Ruby Snap on Ubuntu for a while now, and I think it's a bit better? I've referred to my notes every time I've done it though so I thought I had better put them somewhere I'll find them even when I'm using a new notebook :)

What versions are available?

snap info ruby will show your choices of versions to install. I usually just need a major.minor version combination so I set the version with:

sudo snap switch ruby --channel=2.5/stable
sudo snap refresh

If you see a lot of "extension not built" anger then try this: ruby.gem pristine --extensions

Using Ruby and Gem and Bundle

The snap actually ships with all these commands available as separate commands:

Beware that the 2.5 channel has bundler v2 and the 2.6 channel has v1, I have no idea why but it's tripped me up at least four times now

« USNWC Build Your Own Boat Competition … - Eric L. Barnes

Laravel News - Laravel Ignition Introduces the ddd() … »