Search code examples
rubyjrubyrubiniusmri

How do I tell which Ruby interpreter I'm using?


I've seen this thread, but my question is maybe more basic:

Given that the response from the accepted answer in that thread[1] is for me, "/Users/username/.rvm/rubies/ruby-2.3.0/bin/ruby", how do I know if that's MRI, JRuby, etc? What would it look like if it were each of the other major interpreters?


[1] To save a few seconds, RbConfig.ruby


Solution

  • Nowadays, all mainstream Ruby implementations set the RUBY_ENGINE pseudo-constant. The values for the various implementations which I can remember off the top of my head are:

    • Rubinius: rbx
    • JRuby: jruby
    • TruffleRuby: truffleruby
    • Opal: opal
    • MRuby: mruby
    • YARV: confusingly, ruby
    • MRI: even more confusingly, also ruby
    • MagLev: maglev
    • IronRuby: ironruby
    • MacRuby: macruby
    • Topaz: topaz