Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

ruby on rails - RVM and OSX Lion - RVM 'forgets' gemsets on system restart

I never seemed to have this problem while doing Rails work in Linux, but since changing to OSX everytime I reboot my machine, RVM loses its list of gemsets, but they aren't actually gone.

For example, I have several gemsets already made, and I restart my computer.

I run the following command:

$ rvm gemset list

gemsets for system (found in /Users/evan/.rvm/gems/system)
*

This of course causes havoc when I run rails s to start up my server.

The only way I've managed to get the gemsets back is to create a dummy gemset:

$ rvm --create 1.9.2@blahblah
$ rvm gemset list

gemsets for ruby-1.9.2-p290 (found in /Users/evan/.rvm/gems/ruby-1.9.2-p290)
asdasdads
=> blahblah
global
rails3.1
rails31
test
test3
test6
whymvc

This shows all of the gemsets I have created (and need). At this point I change the gemset back to the one I want:

$ rvm gemset use rails3.1
Using /Users/evan/.rvm/gems/ruby-1.9.2-p290 with gemset rails3.1

At this point I'm back where I need to be to develop functionally until the next reboot.

I believe I followed the directions correctly at the RVM site, and my .bash_profile looks like so:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function

My question is this:

How can I configure RVM to 'remember' the gemsets I have created without creating/deleting dummy ones?

Edit #1 - rvm info output

Running rvm info produces the following output:

$ rvm info

system:

   system:
   uname:       "Darwin emcummings-pc 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug  9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64"
   bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)"
   zsh:         "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)"

rvm:
   version:      "rvm 1.10.0-pre by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]"

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

binaries:
   ruby:         "/usr/bin/ruby"
   irb:          "/usr/bin/irb"
   gem:          "/usr/bin/gem"
   rake:         "/usr/bin/rake"

environment:
  PATH:         "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/evan/.rvm/bin"
  GEM_HOME:     ""
  GEM_PATH:     ""
  MY_RUBY_HOME: ""
  IRBRC:        ""
  RUBYOPT:      ""
  gemset:       ""
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It appears that your default RVM ruby is not set.

Try running this:

rvm use --default --create 1.9.2@rails3.1

and then rebooting.

If your gemset already exists, you can omit the --create.

rvm use --default 1.9.2@rails3.1

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...