Search code examples
rvmzshzshrc

How do I keep my RVM environment from losing its settings?


I installed ZSH today and RVM, I set up Ruby 1.9.3 to be my default. When I type rvm use 1.9.3 --default and then went into my rails project and ran rails s it worked fine. If I close my terminal and then come back to my rails project and try rails s I get the following error:

/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>'

I would then type rvm use 1.9.3 and the error would go away, I did some research and found that rvm info was losing all of my rvm environment variables, here is the output of 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:       ""

How do I make it so my env settings are not lost? Works just fine with bash.


Solution

  • This is issue with loading RVM in proper place of configuration files.

    You can fix it by calling:

    rvm get stable --auto # OR:
    rvm get head --auto
    

    And restart computer - this is important as it forces reload of all config files.