问题描述
在Linux中运行Rails时,我似乎从未遇到过这个问题,但是由于每次我重新启动计算机时都切换到OSX,RVM会丢失其宝石集列表,但实际上并没有消失.
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.
我运行以下命令:
$ rvm gemset list
gemsets for system (found in /Users/evan/.rvm/gems/system)
*
这当然会在我运行rails s
来启动服务器时造成严重破坏.
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
这显示了我创建(和需要)的所有宝石集.此时,我将gemset重新更改为我想要的:
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.
我相信我在RVM站点上正确遵循了指示,我的.bash_profile看起来像这样:
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
我的问题是这个
如何配置RVM以记住"我创建的宝石集,而无需创建/删除虚拟宝石集?
How can I configure RVM to 'remember' the gemsets I have created without creating/deleting dummy ones?
编辑#1-rvm info
输出
Edit #1 - rvm info
output
运行rvm info
会产生以下输出:
$ 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: ""
推荐答案
似乎未设置默认的RVM红宝石.
It appears that your default RVM ruby is not set.
尝试运行此:
rvm use --default --create 1.9.2@rails3.1
然后重新启动.
如果您的宝石集已经存在,则可以省略--create
.
If your gemset already exists, you can omit the --create
.
rvm use --default 1.9.2@rails3.1
这篇关于RVM和OSX Lion-RVM在系统重新启动时“忘记" gemset的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!