Install Ruby

Install on Mac using Ruby Version Manager rvm

Using rvm, install the latest version of the ruby. Using following command you find all available ruby version:

$ rvm list known
MRI Rubies
 [ruby-]1.8.6[-p420]
 [ruby-]1.8.7[-head] # security released on head
 [ruby-]1.9.1[-p431]
 [ruby-]1.9.2[-p330]
 [ruby-]1.9.3[-p551]
 [ruby-]2.0.0[-p648]
 [ruby-]2.1[.10]
 [ruby-]2.2[.10]
 [ruby-]2.3[.8]
 [ruby-]2.4[.9]
 [ruby-]2.5[.7]
 [ruby-]2.6[.5]
 [ruby-]2.7[.0]
 ruby-head
 for forks use: rvm install ruby-head- --url https://github.com/github/ruby.git --branch 2.2
 JRuby
 jruby-1.6[.8]
 jruby-1.7[.27]
 jruby-9.1[.17.0]
 jruby[-9.2.11.0]
...

As you see [ruby-]2.7[.0] is the latest version, using following rvm command install the latest version of ruby

$ rvm install 2.7.0
Searching for binary rubies, this might take some time.
 No binary rubies available for: osx/10.14/x86_64/ruby-2.7.0.
 Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
 Checking requirements for osx.
 Certificates bundle '/usr/local/etc/openssl@1.1/cert.pem' is already up to date.
 Requirements installation successful.
 Installing Ruby from source to: /Users/nkabiliravi/.rvm/rubies/ruby-2.7.0, this may take a while depending on your cpu(s)…
 ruby-2.7.0 - #downloading ruby-2.7.0, this may take a while depending on your connection…
   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                  Dload  Upload   Total   Spent    Left  Speed
 100 14.0M  100 14.0M    0     0  20.5M      0 --:--:-- --:--:-- --:--:-- 20.5M
 ruby-2.7.0 - #extracting ruby-2.7.0 to /Users/nkabiliravi/.rvm/src/ruby-2.7.0 - please wait
 ruby-2.7.0 - #configuring - please wait
 ruby-2.7.0 - #post-configuration - please wait
 ruby-2.7.0 - #compiling - please wait
 ruby-2.7.0 - #installing - please wait
 ruby-2.7.0 - #making binaries executable - please wait
 Installed rubygems 3.1.2 is newer than 3.0.8 provided with installed ruby, skipping installation, use --force to force installation.
 ruby-2.7.0 - #gemset created /Users/nkabiliravi/.rvm/gems/ruby-2.7.0@global
 ruby-2.7.0 - #importing gemset /Users/nkabiliravi/.rvm/gemsets/global.gems - please wait
 ruby-2.7.0 - #generating global wrappers - please wait
 ruby-2.7.0 - #gemset created /Users/nkabiliravi/.rvm/gems/ruby-2.7.0
 ruby-2.7.0 - #importing gemsetfile /Users/nkabiliravi/.rvm/gemsets/default.gems evaluated to empty gem list
 ruby-2.7.0 - #generating default wrappers - please wait
 ruby-2.7.0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
 Install of ruby-2.7.0 - #complete
 Ruby was built without documentation, to build it run: rvm docs generate-ri 

Using rvm list, check the installed ruby version using rvm

$ rvm list
=* ruby-2.7.0 [ x86_64 ]
 => - current
 =* - current && default
 * - default
$ ruby --version  

Leave a Reply