How to use "RVM --default" on MacOSX
After using Ruby and Rails for quite some time now, I wanted to try RVM. Everything works fine, except for one thing:
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 [ ]
Everything is fine after I call 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
I set up my .bash_profile
as described in the documentation:
[[ -s "/Users/user/.rvm/scripts/rvm" ]] && source "/Users/user/.rvm/scripts/rvm"
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 ~ $
I'm using Mac OS X Snow Leopard (10.6.6)
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
and so on, and make sure they don't load RVM twice.
Maybe put
echo "Going to load RVM"
before
[[ -s "/Users/user/.rvm/scripts/rvm" ]] && source "/Users/user/.rvm/scripts/rvm"
in your ~/.bash_profile
to see if it happens or not.
Moving the initialization
[[ -s "/usr/local/rvm/scripts/rvm" ]] && . "/usr/local/rvm/scripts/rvm"
in the bottom of ~/.bash_profile
solved the problem for me.