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 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 TreeSet
[How to use label]
How to use identity
How to use hashes
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
[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)
How to use java class
How to use Big Decimal
[Java] How to use removeAll ()
How to use String [] args
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!
How to use GC Viewer
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
[Rails] How to use gem "devise"
How to use Lombok in Spring
How to use StringBurrer and Arrays.toString.
How to use Java HttpClient (Get)
How to use the include? method
[Rails] How to use devise (Note)
How to use the form_with method
[Rails] How to use flash messages
How to use EventBus3 and ThreadMode
How to use Spring Data JDBC
How to use binding.pry [53 days left]
How to install ruby through rbenv
How to use Java HttpClient (Post)