0

I installed WSL2 and Ubuntu 20.04, which includes Ruby 2.7.0:

$ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]

I would like to install Ruby 3.0.1, but ruby-build doesn't have it:

...
2.4.0-rc1
2.4.0
2.4.1
2.5.0-dev
jruby-1.5.6
jruby-1.6.3
...

I updated apt:

$ sudo apt update
Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Ign:3 https://dl.bintray.com/sbt/debian  InRelease
Get:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:5 https://dl.bintray.com/sbt/debian  Release [815 B]
Get:7 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [982 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [774 kB]
Fetched 1971 kB in 1s (1379 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

But the version of ruby-build is still old:

$ apt show ruby-build
Package: ruby-build
Version: 20170726-1
Priority: optional
...

My OSX machine:

$ ruby-build --version
ruby-build 20210510

Is this an issue w/ Ubuntu, apt, or something else? How do I fix it?

craig
  • 25,664
  • 27
  • 119
  • 205

1 Answers1

2

Ubuntu releases are either "long-term support" (LTS) or "interim releases" (see Ubuntu Release Cycle). The "even-year, April/Spring" (e.g. 20.04 or 22.04) release is the long-term support release, which is designed to have stable, proven software packages that will be supported by Canonical for 5 years. The other 3 interim releases between those (e.g. 20.10, 21.04, 21.10) may update packages to newer releases for testing.

That said, Canonical only puts LTS releases of Ubuntu in the Microsoft Store for WSL. It's possible to upgrade to an interim release. Just be aware that you are on a "less stable" version. You may want to do this in a separate installation and still keep your 20.04 version around. If so, see this answer for my write-up on how to do this. There's still no guarantee that 21.04 includes a later ruby-build. It obviously wouldn't have the May 10th release. I haven't checked the package list to see what ruby-build version is in 21.04.

Anyway, I'd propose a different alternative. You mention that your MacOS version is the latest, and I'm assuming you installed it with Homebrew (brew). The ruby-build maintainers are the ones who update that package and make sure the latest is available through Homebrew. If you want to install and use Homebrew on WSL, you can as well. I haven't done this myself, but it seems entirely possible from the Homebrew doc. I think I'd purge the ruby-build package you installed from the Ubuntu repositories first, though, to avoid conflicts.

NotTheDr01ds
  • 15,620
  • 5
  • 44
  • 70