Command Line

Use specific Ruby version with rbenv

rbenv shell _version_

$ rbenv shell 2.6.3
$ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
$ rbenv shell 2.5.1
$ ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin18]

Set specific Ruby version globally

rbenv global _version_

$ cat ~/.rbenv/version
2.3.1
$ rbenv global 2.5.1
$ cat ~/.rbenv/version
2.5.1

Deleting global .ruby-version with rbenv

rbenv global --unset

$ rbenv global 2.5.1
$ cat ~/.rbenv/version
2.5.1
$ rbenv global --unset
$ cat ~/.rbenv/version 
cat: .ruby-version: No such file or directory

Set specific Ruby version by setting .ruby-version

rbenv local _version_

$ rbenv local 2.3.1
$ cat .ruby-version 
2.3.1
$ rbenv local 2.5.1
$ cat .ruby-version 
2.5.1

Deleting local .ruby-version with rbenv

rbenv local --unset

$ rbenv local 2.5.1
$ cat .ruby-version 
2.5.1
$ rbenv local --unset
$ cat .ruby-version 
cat: .ruby-version: No such file or directory

Reference

rbenv github project