There are multiple ways you could find out which Ruby version you are running on your local machine.
Prerequisites
- Ruby environment
which command
$ which ruby
Example output:
/Users/devcoops/.rvm/rubies/ruby-3.0.0/bin/ruby
CLI
$ ruby -v
Example output:
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin21]
Ruby version management tools
Using RVM:
$ rvm current
Example output:
ruby-3.0.0
Using rbenv:
$ rbenv version
Example output:
3.0.0p0 (set by /Users/devcoops/.rbenv/version)
interactive Ruby
Step 1.
$ irb
Step 2.
RUBY_VERSION
Example output:
=> "3.0.0"
package manager (gem)
$ gem env
Example output:
RubyGems Environment:
- RUBYGEMS VERSION: 3.2.3
- RUBY VERSION: 3.0.0 (2020-12-25 patchlevel 0) [x86_64-darwin21]
...
Conclusion
As always, hope this was helpful and If you know any other ways to check running or installed ruby version, please let me know. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.