问题描述
在使用Ruby和Rails一段时间之后,我想尝试RVM.一切正常,除了一件事:
After using Ruby and Rails for quite some time now, I wanted to try RVM. Everything works fine, except for one thing:
在新打开的终端中,ruby
指向系统的红宝石,尽管事实是我使用了rvm --default
命令.
In a freshly opened Terminal ruby
points to the system's ruby, despite the fact, that I used the rvm --default
command.
user@terra ~ $ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10]
user@terra ~ $ which ruby
/opt/local/bin/ruby
user@terra ~ $ rvm list
ruby-1.8.7-p334 [ ]
=> ruby-1.9.2-p180 [ ]
打电话给rvm reload
user@terra ~ $ rvm reload
user@terra ~ $ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.1]
tmangner@terra ~ $ which ruby
/Users/user/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
我按照文档中的说明设置了.bash_profile
:
I set up my .bash_profile
as described in the documentation:
[[ -s "/Users/user/.rvm/scripts/rvm" ]] && source "/Users/user/.rvm/scripts/rvm"
那个--default
似乎对我不起作用...
That --default
does not seem to work for me ...
user@terra ~ $ rvm use 1.9.2 --default
Using /Users/user/.rvm/gems/ruby-1.9.2-p180
user@terra ~ $ rvm default
user@terra ~ $
我正在使用Mac OS X Snow Leopard(10.6.6)
I'm using Mac OS X Snow Leopard (10.6.6)
推荐答案
我曾经遇到过同样的问题.原来rvm脚本被加载了两次,这使事情有点混乱了.
I had the same problem once. It turned out the rvm-script got loaded twice, which broke things a bit.
检查打开外壳程序时加载的所有文件:
Check all the files that load when you open a shell:
/etc/profile
~/.bashrc
~/.bash_profile
,依此类推,并确保它们不会两次加载RVM.
and so on, and make sure they don't load RVM twice.
也许放
echo "Going to load RVM"
之前
[[ -s "/Users/user/.rvm/scripts/rvm" ]] && source "/Users/user/.rvm/scripts/rvm"
在您的~/.bash_profile
中
查看它是否发生.
in your ~/.bash_profile
to see if it happens or not.
这篇关于如何使用"RVM --default"在MacOSX上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!