为何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 <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [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 <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [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



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值