Update Ruby version using Rbenv
Follow the below steps to update Ruby version. When upgrading Ruby, always check the latest version available on the official website.
Update ruby-build
Pull the latest version of ruby-build since that version would support installing the latest version of Ruby. When new versions of Ruby are released you need to update ruby-build to install those versions.
$ cd ~/.rbenv/plugins/ruby-build && git pull && cd -
Install Ruby by specifying version number
$ rbenv install 2.6.2
Set the new version as global version
$ rbenv global 2.6.2
(Optional) Install bundler
If you are using Rails, you would want to install the latest version of bundler for the new Ruby version you just installed.
# Check the currently active Ruby version. If it's correct, proceed.
$ ruby --version
ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-darwin18]
$ gem install bundler
Reference Links
by Harshal Bhakta
tags: rubycomments powered by Disqus