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
Output:
/Users/devcoops/.rvm/rubies/ruby-3.0.0/bin/ruby
CLI
ruby -v
Output:
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin21]
Ruby version management tools
Using RVM:
rvm current
Output:
ruby-3.0.0
Using rbenv:
rbenv version
Output:
3.0.0p0 (set by /Users/devcoops/.rbenv/version)
interactive Ruby
Step 1.
irb
Step 2.
RUBY_VERSION
Output:
=> "3.0.0"
package manager (gem)
gem env
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.