DEV Community

Cover image for Install latest version of Ruby and Rails using Snap
Guga Cavalieri
Guga Cavalieri

Posted on

Install latest version of Ruby and Rails using Snap

I just started working with a new stack today and it involves a lot of techs that I have never worked with (Ruby, Rails).

I was having a hard time to create a new project with Rails 6.x mostly because the Ruby installed in my Ubuntu via apt-get was pointing to version 2.4.5.

I needed something newer ... And snapd was there to rescue me.

By running:

gustavo@bulls:~$ snap install ruby

and

gustavo@bulls:~$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]

I finally got the newest version of Ruby and could finally do:

gustavo@bulls:~$ gem install rails
...
gustavo@bulls:~$ rails -v
Rails 6.0.3.1

Thank you snap. Well, here are some advantages of using ruby with snap:

  • Keep ruby and rail in a separate sandbox preserving your OS packages.
  • You can always get the latest version even if your OS do not provide them (don't be angry Arch Users)
  • Easy to install/remove without breaking anything :)

Well, here is the blog post from Ruby blog!

Any other tips for today guys?

Top comments (1)

Collapse
 
ali-alkhawaja profile image
Ali Al Khawaja

How did set-up Ruby-LSP with ruby ?
I am having a hard time installing it