[Ruby] Manage version of Ruby itself with rbenv

less than 1 minute read

What is this?

This is a memo when installing via the Version management tool when installing Ruby. Installed on Ubuntu.


Install rbenv

$ sudo apt-get update
$ cd
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ echo'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
$ echo'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
$ source ~/.bashrc

Install Ruby

Install by specifying the version you like, and specify the version to use.

$ rbenv install -l
$ rbenv install 2.7.1
$ rbenv global 2.3.1

Install bundler

$ gem install bundler
$ rbenv rehash

Install the bundle package

$ bundle install