Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 826
Ordep81 Avatar asked Aug 31 '13 14:08

Ordep81


People also ask

How can you tell if a ruby is running?

To verify that you have a current version of Ruby, run the command ruby -v. Compare the version number returned with the version number on the Ruby download page.

How do I know what version of ruby I have Mac?

Don't type the $ character – the $ character is just a cue that you should enter a shell command. The ruby -v command will show you the Ruby version number.

Which Ruby Version Manager is best?

Along with RVM, Rbenv has long been the most popular version manager for Ruby. Rbenv uses shims to intercept common Ruby commands. (Asdf also uses shims.) After installing Rbenv with Homebrew, you must modify your ~/.


1 Answers

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.

like image 125
Anshul Goyal Avatar answered Sep 27 '22 23:09

Anshul Goyal