爲何RVM設置ruby時加default導致找不到ruby



zsg@zsg-Vostro-1014:~$ rvm use 1.9.2
Using /home/zsg/.rvm/gems/ruby-1.9.2-p290
zsg@zsg-Vostro-1014:~$ rvm info

ruby-1.9.2-p290:

  system:
    uname:       "Linux zsg-Vostro-1014 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 i686 i686 i386 GNU/Linux"
    bash:        "/bin/bash => GNU bash, 版本 4.2.8(1)-release (i686-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.10.2 by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.beginrescueend.com/]"
    updated:      "5 hours 14 minutes 8 seconds ago"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.2p290"
    date:         "2011-07-09"
    platform:     "i686-linux"
    patchlevel:   "2011-07-09 revision 32553"
    full_version: "ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]"

  homes:
    gem:          "/home/zsg/.rvm/gems/ruby-1.9.2-p290"
    ruby:         "/home/zsg/.rvm/rubies/ruby-1.9.2-p290"

  binaries:
    ruby:         "/home/zsg/.rvm/rubies/ruby-1.9.2-p290/bin/ruby"
    irb:          "/home/zsg/.rvm/rubies/ruby-1.9.2-p290/bin/irb"
    gem:          "/home/zsg/.rvm/rubies/ruby-1.9.2-p290/bin/gem"
    rake:         "/home/zsg/.rvm/gems/ruby-1.9.2-p290/bin/rake"

  environment:
    PATH:         "/home/zsg/.rvm/gems/ruby-1.9.2-p290/bin:/home/zsg/.rvm/gems/ruby-1.9.2-p290@global/bin:/home/zsg/.rvm/rubies/ruby-1.9.2-p290/bin:/home/zsg/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
    GEM_HOME:     "/home/zsg/.rvm/gems/ruby-1.9.2-p290"
    GEM_PATH:     "/home/zsg/.rvm/gems/ruby-1.9.2-p290:/home/zsg/.rvm/gems/ruby-1.9.2-p290@global"
    MY_RUBY_HOME: "/home/zsg/.rvm/rubies/ruby-1.9.2-p290"
    IRBRC:        "/home/zsg/.rvm/rubies/ruby-1.9.2-p290/.irbrc"
    RUBYOPT:      ""
    gemset:       ""


zsg@zsg-Vostro-1014:~$ rvm use 1.9.2 default
Now using system ruby.
zsg@zsg-Vostro-1014:~$ rvm info

system:

  system:
    uname:       "Linux zsg-Vostro-1014 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 i686 i686 i386 GNU/Linux"
    bash:        "/bin/bash => GNU bash, 版本 4.2.8(1)-release (i686-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.10.2 by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.beginrescueend.com/]"
    updated:      "5 hours 14 minutes 19 seconds ago"

  homes:
    gem:          "not set"
    ruby:         "not set"

  binaries:
    ruby:         ""
    irb:          ""
    gem:          ""
    rake:         "/home/zsg/.rvm/bin/rake"

  environment:
    PATH:         "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/zsg/.rvm/bin"
    GEM_HOME:     ""
    GEM_PATH:     ""
    MY_RUBY_HOME: ""
    IRBRC:        ""
    RUBYOPT:      ""
    gemset:       ""
/////////////////////////////

解決:

Setting the default Ruby

If you would like to make one specific Ruby be the default ruby that is selected when you open a new terminal shell, use the --default flag:

$ rvm --default use 1.9.2

$ ruby -v

ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]

The next time you open a window Ruby 1.9.2 will be the selected ruby.

To switch back to your system ruby:

$ rvm use system

$ ruby -v

ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]

To switch at any time to the ruby you have selected as default:

$ rvm default

$ ruby -v

ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]

To show what ruby is currently the selected default, if any, do

$ rvm list default

Default Ruby (for new shells)

   ruby-1.9.2-p0 [ x86_64 ]

If you wish to switch back to your system ruby as default, remember that RVM does not "manage" the system ruby and is "hands off".

This means to set the "system" ruby as default, you reset RVM's defaults as follows.

$ rvm reset



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章