loading...

Installing the latest version of Ruby on Raspberry pi

konyu profile image @kon_yu Updated on ・2 min read

First

  • This is almost the same way to install in Debian.
  • Please be patient because it may take several hours to install Razpai because the spec is low.

Prerequisites

  • Body: Raspberry Pi 1 Model B+
  • Memory card: 8GB
  • OS: Latest version of Raspbian installed

rbenv installation

Install rbenv and write the configuration to the bash configuration file, if you use zsh, etc.

> sudo apt-get install rbenv
> echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .bashrc
> echo 'eval "$(rbenv init -)"' >> .bashrc

Confirmation of installation

> rbenv
> rbenv x.x.x #version to be displayed

Installing ### git

If git is not installed, install git.

> sudo apt-get install git

Install ruby-build

I'm going to clone ruby-build from git.

> git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build

> rbenv install --list
there are 2.3.1 and the latest version of Cruby 2.3

rbenv install 2.3.1

Troubleshooting

If you don't have enough libraries in your Ruby installation, you can try to add them by using the following command

> sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev

Reference: https://github.com/rbenv/ruby-build/wiki#suggested-build-environment

If you installed ruby-build with apt-get

Even if I install ruby-build by apt-get, there is no latest version of Ruby in the list of available installables.
At runtime, ruby-2.2.0-preview is the latest version, and there is no 2.3 system of the latest version at this time.

> sudo apt-get install ruby-build
> rbenv install --list

To uninstall ruby-build, click here

> sudo apt-get remove ruby-build

Discussion

pic
Editor guide