如何防止RVM环境丢失其设置?

时间:2012-03-22 15:31:31

标签: rvm zsh zshrc

我今天安装了ZSH和RVM,我将Ruby 1.9.3设置为我的默认设置。当我输入rvm use 1.9.3 --default然后进入我的rails项目并运行rails s时,它运行正常。如果我关闭终端然后回到我的rails项目并尝试rails s我收到以下错误:

/Users/jeff/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
    from /Users/jeff/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /Users/jeff/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1229:in `gem'
    from /Users/jeff/.rvm/gems/ruby-1.9.3-p125/bin/rails:18:in `<main>'

然后我会输入rvm use 1.9.3,错误就会消失,我做了一些研究,发现rvm info丢失了所有的rvm环境变量,这里是rvm info的输出:

system:

  system:
    uname:       "Darwin binfalse.local 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64"
    bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)"
    zsh:         "/opt/local/bin/zsh => zsh 4.3.17 (x86_64-apple-darwin11.3.0)"

  rvm:
    version:      "rvm 1.10.3 by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.beginrescueend.com/]"
    updated:      "51 minutes 38 seconds ago"

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

  binaries:
    ruby:         "/Users/jeff/.rvm/rubies/ruby-1.9.3-p125/bin/ruby"
    irb:          "/Users/jeff/.rvm/rubies/ruby-1.9.3-p125/bin/irb"
    gem:          "/Users/jeff/.rvm/rubies/ruby-1.9.3-p125/bin/gem"
    rake:         "/Users/jeff/.rvm/gems/ruby-1.9.3-p125/bin/rake"

  environment:
    PATH:         "/Users/jeff/.rvm/gems/ruby-1.9.3-p125/bin:/Users/jeff/.rvm/gems/ruby-1.9.3-p125@global/bin:/Users/jeff/.rvm/rubies/ruby-1.9.3-p125/bin:/Users/jeff/.rvm/bin:/opt/local/bin:/opt/local/sbin:/Library/PostgreSQL/9.0/bin:/usr/local/mysql/bin:/usr/local/mysql:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
    GEM_HOME:     ""
    GEM_PATH:     ""
    MY_RUBY_HOME: ""
    IRBRC:        ""
    RUBYOPT:      ""
    gemset:       ""

如何制作,以便我的环境设置不会丢失?用bash工作得很好。

1 个答案:

答案 0 :(得分:4)

这是将RVM加载到配置文件的适当位置的问题。

你可以通过调用:

来修复它
rvm get stable --auto # OR:
rvm get head --auto

重新启动计算机 - 这很重要,因为它会强制重新加载所有配置文件。