[RUBY] How to use rbenv

This time, I bought Junichi Ito's introduction to Ruby and started learning. I had to change the version of Ruby, so I looked into rbenv.

What is rbenv

It is a tool that switches the version of Ruby. First of all, I would like to install rbenv.

How to install rbenv

Terminal


#Initialization settings
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
#Reflection of initialization settings
$ source ~/.bash_profile
#Install rbenv
$ brew install rbenv ruby-build

Installation is complete here. The following describes how to install the specified version of Ruby.

How to install the specified version of Ruby

Terminal


#Display a list of installable Ruby versions
$ rbenv install -l
#Install the version of Ruby you want to install from the list
$ rbenv install 2.4.1
#Make the installed version of Ruby available
$ rbenv rehash

If you want to install multiple versions, you can repeat the above.

Folder structure of rbenv

~ / .rbenv / (root folder) ~ / .rbenv / shims / (folder to save wrappers for commands installed by ruby and gem) ~ / .rbenv / version (file that records the globally set Ruby version) ~ / .rbenv / versions / (Folder to install other installed Ruby versions)

Source: What is rbenv-Qiita

Specify the version to use

Terminal


#Switch the version of Ruby used for the entire PC
$ rbenv global 2.4.1
#Check if it was installed
$ ruby -v

Referenced articles

Role of rbenv-Qiita

Recommended Posts

How to use rbenv
How to use Map
How to use letter_opener_web
How to use with_option
How to use fields_for
How to use java.util.logging
How to use map
How to use collection_select
How to use Twitter4J
How to use active_hash! !!
How to use MapStruct
How to use hidden_field_tag
How to use TreeSet
[How to use label]
How to use identity
How to use hashes
How to use JUnit 5
How to use Dozer.mapper
How to use Gradle
How to use org.immutables
How to use java.util.stream.Collector
How to use VisualVM
How to use Map
How to use Chain API
[Java] How to use Map
How to use Priority Queuing
[Rails] How to use enum
How to use java Optional
How to use JUnit (beginner)
How to use Ruby return
[Rails] How to use enum
How to use @Builder (Lombok)
[Swift] How to use UserDefaults
How to use java class
How to use Swift UIScrollView
How to use Big Decimal
[Java] How to use Optional ②
[Java] How to use removeAll ()
How to use String [] args
[Java] How to use string.format
How to use rails join
How to use Java Map
Rbenv command to use Ruby
Ruby: How to use cookies
How to use dependent :: destroy
How to use Eclipse Debug_Shell
How to use Apache POI
[Rails] How to use validation
How to use Java variables
[Rails] How to use authenticate_user!
[Rails] How to use "kaminari"
How to use GC Viewer
[Java] How to use Optional ①
How to use Lombok now
[Creating] How to use JUnit
[Rails] How to use Scope
[Ruby] How to use rbenv (version `x.x.x'is not installed)
How to use the link_to method
How to use arrays (personal memorandum)
How to use scope (JSP & Servlet)
How to use the include? method