[ruby-on-rails] Which Ruby version am I really running?

I'm running Ubuntu 12.04 LTS, and installed Ruby via RVM.

The problem is, when I type ruby -v into the terminal, it says that my Ruby version is 1.8.7, and using the shotgun gem for Sinatra also says that I'm running Ruby 1.8.7.

But when I type rvm list it shows that the only version of Ruby that I have installed is 2.0.0 and it is my current and default version.

I installed Ruby 2.0.0 via RVM and it is the only version I had installed on my machine.

Now when I tried to install Rails 4 but got an error saying that I need Ruby 1.9 or higher.

How do I know what version am I really on, and how do I set 2.0.0 as my only version?

This question is related to ruby-on-rails ruby rvm ubuntu-12.04

The answer is


Run this command:

rvm get stable --auto-dotfiles

and make sure to read all the output. RVM will tell you if something is wrong, which in your case might be because GEM_HOME is set to something different then PATH.


The ruby version 1.8.7 seems to be your system ruby.

Normally you can choose the ruby version you'd like, if you are using rvm with following. Simple change into your directory in a new terminal and type in:

rvm use 2.0.0

You can find more details about rvm here: http://rvm.io Open the website and scroll down, you will see a few helpful links. "Setting up default rubies" for example could help you.

Update: To set the ruby as default:

rvm use 2.0.0 --default

On your terminal, try running:

which -a ruby

This will output all the installed Ruby versions (via RVM, or otherwise) on your system in your PATH. If 1.8.7 is your system Ruby version, you can uninstall the system Ruby using:

sudo apt-get purge ruby

Once you have made sure you have Ruby installed via RVM alone, in your login shell you can type:

rvm --default use 2.0.0

You don't need to do this if you have only one Ruby version installed.

If you still face issues with any system Ruby files, try running:

dpkg-query -l '*ruby*'

This will output a bunch of Ruby-related files and packages which are, or were, installed on your system at the system level. Check the status of each to find if any of them is native and is causing issues.


If you have access to a console in the context you are investigating, you can determine which version you are running by printing the value of the global constant RUBY_VERSION.


Examples related to ruby-on-rails

Embed ruby within URL : Middleman Blog Titlecase all entries into a form_for text field Where do I put a single filter that filters methods in two controllers in Rails Empty brackets '[]' appearing when using .where How to integrate Dart into a Rails app Rails 2.3.4 Persisting Model on Validation Failure How to fix "Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5" while server starting Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? Rails: Can't verify CSRF token authenticity when making a POST request Uncaught ReferenceError: React is not defined

Examples related to ruby

Uninitialized Constant MessagesController Embed ruby within URL : Middleman Blog Titlecase all entries into a form_for text field Ruby - ignore "exit" in code Empty brackets '[]' appearing when using .where find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException) How to update Ruby Version 2.0.0 to the latest version in Mac OSX Yosemite? How to fix "Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5" while server starting Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? How to update Ruby with Homebrew?

Examples related to rvm

How to resolve "gpg: command not found" error during RVM installation? RVM is not a function, selecting rubies with 'rvm use ...' will not work SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/ Which Ruby version am I really running? rvm installation not working: "RVM is not a function" Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v rmagick gem install "Can't find Magick-config" How to Uninstall RVM? How to remove RVM (Ruby Version Manager) from my system

Examples related to ubuntu-12.04

Increasing Heap Size on Linux Machines wget: unable to resolve host address `http' How to check which PHP extensions have been enabled/disabled in Ubuntu Linux 12.04 LTS? java.lang.Exception: No runnable methods exception in running JUnits Speed up rsync with Simultaneous/Concurrent File Transfers? MySQL Job failed to start CronJob not running libz.so.1: cannot open shared object file error: could not create '/usr/local/lib/python2.7/dist-packages/virtualenv_support': Permission denied Package doesn't exist error in intelliJ