daBee
Posts: 82
Joined: Fri Mar 06, 2015 8:25 pm
Location: Toronto
Contact: Website

Install Latest Ruby

Tue Apr 06, 2021 8:11 pm

I'm looking at installing the latest version of ruby using rbenv. I would prefer version 2.7.2 or later (3.0 even) but this is what I'm finding:

Code: Select all

$ rbenv install -l  # =>   2.5.0-dev is latest
$ rbenv install 2.5.0-dev
Cloning https://github.com/ruby/ruby.git...

BUILD FAILED (Raspbian 10 using ruby-build 20170726)

$ ruby -v
ruby 2.5.5p157 (2019-03-15 revision 67260) [arm-linux-gnueabihf]
So I can't even install what's reported to be the latest.

How can I fix this? Is there another way of getting a more recent version? System version is 2.5.5. I should add this is on a RP4.

Cheers

fruitoftheloom
Posts: 26518
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Install Latest Ruby

Tue Apr 06, 2021 8:48 pm

daBee wrote:
Tue Apr 06, 2021 8:11 pm
I'm looking at installing the latest version of ruby using rbenv. I would prefer version 2.7.2 or later (3.0 even) but this is what I'm finding:

Code: Select all

$ rbenv install -l  # =>   2.5.0-dev is latest
$ rbenv install 2.5.0-dev
Cloning https://github.com/ruby/ruby.git...

BUILD FAILED (Raspbian 10 using ruby-build 20170726)

$ ruby -v
ruby 2.5.5p157 (2019-03-15 revision 67260) [arm-linux-gnueabihf]
So I can't even install what's reported to be the latest.

How can I fix this? Is there another way of getting a more recent version? System version is 2.5.5. I should add this is on a RP4.

Cheers

Build from Source version 3.x

https://www.ruby-lang.org/en/downloads/
The information is out there....you just have to let it in.

My other Linux machines: ChromeBox
https://www.aliexpress.com/item/32966393971.html
& Stone Desktop Intel CoreDuo circa 2010

4kruby
Posts: 31
Joined: Thu Oct 22, 2020 3:58 pm

Re: Install Latest Ruby

Wed Apr 07, 2021 3:04 am

Hi,

I mostly use my RPi 4(2gb) for Ruby development.

I installed ruby on it following this guide :

https://www.theodinproject.com/paths/fu ... rogramming

I have tried this both in Raspbian OS, and Arch Linux arm and the installation works fine.

daBee
Posts: 82
Joined: Fri Mar 06, 2015 8:25 pm
Location: Toronto
Contact: Website

Re: Install Latest Ruby

Wed Apr 07, 2021 3:38 pm

RPi? I'm already using rbenv, which installs 2.5.1 when the OS has 2.5.5 as system.

Thanks for the leads. Seems building my own is the solution.

daBee
Posts: 82
Joined: Fri Mar 06, 2015 8:25 pm
Location: Toronto
Contact: Website

Re: Install Latest Ruby

Wed Apr 07, 2021 5:05 pm

Excellent. 3.0.1 installed and with some ownership changes for gem installation, all things are functional.

Cheers

4kruby
Posts: 31
Joined: Thu Oct 22, 2020 3:58 pm

Re: Install Latest Ruby

Thu Apr 08, 2021 4:44 am

daBee wrote:
Wed Apr 07, 2021 3:38 pm
RPi? I'm already using rbenv, which installs 2.5.1 when the OS has 2.5.5 as system.

Thanks for the leads. Seems building my own is the solution.
RPi4 = Raspberry Pi 4
I told I am using rbenv on Raspberry Pi 4.
i successfully installed 2.7 ruby using rbenv from the link above

daBee
Posts: 82
Joined: Fri Mar 06, 2015 8:25 pm
Location: Toronto
Contact: Website

Re: Install Latest Ruby

Thu Apr 08, 2021 5:50 pm

Been using rbenv for many years on various platforms. 2.7.x is not mentioned in the maintained packages:

Code: Select all

$ rbenv install -l
<snip>
  2.3.2
  2.3.3
  2.3.4
  2.4.0-dev
  2.4.0-preview1
  2.4.0-preview2
  2.4.0-preview3
  2.4.0-rc1
  2.4.0
  2.4.1
  2.5.0-dev
  jruby-1.5.6
  <snip>

4kruby
Posts: 31
Joined: Thu Oct 22, 2020 3:58 pm

Re: Install Latest Ruby

Fri Apr 09, 2021 2:19 am

I am not sure what you meant by "maintained packages". But when I install using these commands, I get the following results:
Note: Below snips are run in my PC
rbenv source:

Code: Select all

$ git clone https://github.com/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
$ echo 'eval "$(rbenv init -)"' >> ~/.zshrc
$ exit

$ mkdir -p "$(rbenv root)"/plugins
$ git clone https://github.com/rbenv/rbenv-build.git "$(rbenv root)"/plugins/ruby-build
rbenv version

Code: Select all

$ rbenv -v
  rbenv 1.1.2-44-gd604acb

available ruby versions:

Code: Select all

$ rbenv install -l 
  2.6.7
  2.7.3
  3.0.1
  jruby-9.2.17.0
  mruby-2.1.2
  rbx-5.0
  truffleruby-21.0.0
  truffleruby+graalvm-21.0.0

  Only latest stable releases for each Ruby implementation are shown.
  Use 'rbenv install --list-all / -L' to show all local versions.
May be you are using older version of rbenv or using a different maintained package?

anyway, you got what you wanted.

EDIT:

I tried to install 3.0.1, it took a while and went well.

Code: Select all

$ rbenv install 3.0.1 --verbose
$ rbenv global 3.0.1
$ ruby -v
  ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux]
Cheers

daBee
Posts: 82
Joined: Fri Mar 06, 2015 8:25 pm
Location: Toronto
Contact: Website

Re: Install Latest Ruby

Fri Apr 09, 2021 1:07 pm

You're using zsh. You didn't ssh into your RP4. You installed rbenv and ruby on your PC.

4kruby
Posts: 31
Joined: Thu Oct 22, 2020 3:58 pm

Re: Install Latest Ruby

Sat Apr 10, 2021 9:53 am

daBee wrote:
Fri Apr 09, 2021 1:07 pm
You're using zsh. You didn't ssh into your RP4. You installed rbenv and ruby on your PC.
Seriously?

Well, for some reason, my power supply was not able to power the PI. So, I ordered an official one and got it now.
The same goes true for even raspberry pi 4B.

Here you go from raspbian OS running on Raspberri pi 4, 2GB

Code: Select all

$ rbenv install -l
  2.5.8
  2.6.6
  2.7.2
  3.0.0
  jruby-9.2.14.0
  mruby-2.1.2
  rbx-5.0
  truffleruby-20.3.0
  truffleruby+graalvm-20.3.0

  Only latest stable releases for each Ruby implementation are shown.
  Use 'rbenv install --list-all / -L' to show all local versions.
$ ruby -v
  ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [armv7l-linux-eabihf]
$ rbenv global 3.0.0
$ ruby -v
  ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [armv7l-linux-eabihf]
$ rbenv global 2.7.0
$ ruby -v
  ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [armv7l-linux-eabihf]


daBee
Posts: 82
Joined: Fri Mar 06, 2015 8:25 pm
Location: Toronto
Contact: Website

Re: Install Latest Ruby

Mon Apr 12, 2021 3:16 am

What is the result of these:

Code: Select all

lsb_release -a
rbenv -v

4kruby
Posts: 31
Joined: Thu Oct 22, 2020 3:58 pm

Re: Install Latest Ruby

Mon Apr 12, 2021 4:05 am

daBee wrote:
Mon Apr 12, 2021 3:16 am
What is the result of these:

Code: Select all

lsb_release -a
rbenv -v

Code: Select all

$ rbenv -v
  rbenv 1.1.2-40-g62d7798
$ lsb_release -a
  No LSB modules are available.
  Distributor ID:	Raspbian
  Description:	Raspbian GNU/Linux 10 (buster)
  Release:	10
  Codename:	buster

daBee
Posts: 82
Joined: Fri Mar 06, 2015 8:25 pm
Location: Toronto
Contact: Website

Re: Install Latest Ruby

Mon Apr 12, 2021 1:06 pm

What about this:

Code: Select all

echo $SHELL
Which OS did you download? Did you use the Imager v1.6?

4kruby
Posts: 31
Joined: Thu Oct 22, 2020 3:58 pm

Re: Install Latest Ruby

Mon Apr 12, 2021 3:40 pm

daBee wrote:
Mon Apr 12, 2021 1:06 pm
What about this:

Code: Select all

echo $SHELL

Code: Select all

/bin/bash
daBee wrote:
Mon Apr 12, 2021 1:06 pm
Which OS did you download? Did you use the Imager v1.6?
I have total of 3 SD cards which I swap and use.
1. The official noobs card (which had the raspbian OS pre-installed)
2. Arch Linux on a 32 GB card (manual install)
3. RISC OS (using Imager 1.5 - this version is the default one which came with the Raspbian card).

All the above outputs which I gave from my RPI4 are from the Offical Noobs card having the raspbian OS.
And, the same is true even in Arch Linux.

daBee
Posts: 82
Joined: Fri Mar 06, 2015 8:25 pm
Location: Toronto
Contact: Website

Re: Install Latest Ruby

Mon Apr 12, 2021 4:04 pm

OK that's why the variants are presenting. The core headless RP OS is the one I downloaded.

You are using the BASH shell, but you're writing to .zshrc which is a preloader for the zsh shell. That's why I started asking about your setup.

Here is my uname -a:

Code: Select all

Linux abc.local 5.10.17-v7l+ #1403 SMP Mon Feb 22 11:33:35 GMT 2021 armv7l GNU/Linux
Post yours and you might see it being a different version of Linux itself.

4kruby
Posts: 31
Joined: Thu Oct 22, 2020 3:58 pm

Re: Install Latest Ruby

Mon Apr 12, 2021 5:06 pm

ok I get it.

Code: Select all

Linux raspberrypi 5.4.79-v7l+ #1373 SMP Mon Nov 23 13:27:40 GMT 2020 armv7l GNU/Linux
about the zsh - thats in my PC where I use Manjaro (if you read my above posts clearly it will be apparent)

In in RPI4, I use bash and write to bashrc.

If you found the solution, then good.

Cheers.

daBee
Posts: 82
Joined: Fri Mar 06, 2015 8:25 pm
Location: Toronto
Contact: Website

Re: Install Latest Ruby

Mon Apr 12, 2021 6:23 pm

I did 100% read what you put. That's why I'm posting this. You've also spoken about other OS that have absolutely nothing to do with this conversation. Shoving items into your local .zshrc means nothing when you've ssh'd into your RP4. Your PC shell directives don't take hold on a box you're logged in. Stating what you've done to your PC means nothing.

Return to “Beginners”