Which Ruby version am I really running?

前端 未结 4 1100
[愿得一人]
[愿得一人] 2020-12-10 10:39

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

相关标签:
4条回答
  • 2020-12-10 11:03

    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
    
    0 讨论(0)
  • 2020-12-10 11:15

    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.

    0 讨论(0)
  • 2020-12-10 11:18

    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.

    0 讨论(0)
  • 2020-12-10 11:21

    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.

    0 讨论(0)
提交回复
热议问题