This is a card in Dave's Virtual Box of Cards.

Install a newer version of Ruby in Slackware (and beyond!)

Created: 2022-03-16

Yeah, Slackware 15.0 is out now, but my work-from-home "office computer" is still running 14.2 and will continue to do so until it’s no longer possible. This is where I want the most boring stability possible in a computer.

Slackware 14.2 ships with Ruby 2.2.10.

The easiest and best way to fix this at a user level (without messing up anything at the system level which might depend on the older version), is with rbenv. has it, so installing with sbopkg is no problem.

Here we go…​

$ sudo -i
# sbopkg -i rbenv

  ...installs rbenv 1.1.2 no problem...

$ rbenv init
# Load rbenv automatically by appending
# the following to ~/.bash_profile:

eval "$(rbenv init -)"

I share a .bash_profile across computers see my GNU Stow article, so I check if rbenv is executable first:

# .bash_profile
type -P rbenv &> /dev/null && eval "$(rbenv init -)"

Then pick a Ruby version and install it:

$ rbenv install -l

dave@callisto~$ rbenv install 3.1.1
Downloading ruby-3.1.1.tar.gz...
Installing ruby-3.1.1...
Installed ruby-3.1.1 to /home/dave/.rbenv/versions/3.1.1

$ rbenv versions
* system (set by /home/dave/.rbenv/version)

Verify rbenv "installed":

$ echo $PATH

Set version of Ruby to use and check it:

dave@callisto~$ rbenv global 3.1.1

dave@callisto~$ ruby --version
ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux]

Now I can continue on with Selenium…​ ruby-selenium