热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

为何RVM设置ruby时加default导致找不到ruby

zsg@zsg-Vostro-1014:~$rvmuse1.9.2Usinghomezsg.rvmgemsruby-1.9.2-p290zsg@zsg-Vos



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 , Michal Papis [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 , Michal Papis [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




推荐阅读
author-avatar
七夜绅士
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有