I have problem changing the default ruby. Running OS X Lion.
macbook:~ work$ rvm list
rvm rubies
=* ruby-1.9.2-p290 [ x86_64 ]
ruby-1.9.2-p318 [ x86_64 ]
As you can see, 1.9.2-p290 is the default.
macbook:~ work$ rvm use --default ruby-1.9.2-p318
Using /usr/local/rvm/gems/ruby-1.9.2-p318
macbook:~ work$ rvm list
rvm rubies
* ruby-1.9.2-p290 [ x86_64 ]
=> ruby-1.9.2-p318 [ x86_64 ]
After running rvm use --default ruby-1.9.2-p318, the Ruby changed, but default is still p290. And the next time I reopen a shell, the ruby used is p290.
Any ideas?
Thanks.
You have multi-user installation, but I provide also information/instructions for user installation.
For multi-user installations:
Multi-user installations use /etc/profile.d/rvm.sh - this file is sourced every time any shell is spawned, this includes when you login, anything you do is already working in context of the loaded earlier default.
You need to restart computer for this to make effect.
For user installations:
you need to update your .*rc configuration files for --default
to take effect:
rvm get stable --auto
and restart your computer.
Restart required for both
Restart is required because the earlier default was loaded before/while logging in, with the updated config files the loading point moves to proper place and there should be no more problems with changing default.
Default in scripting
When RVM is used as binary from $rvm_path/bin/rvm it can not set --default
as it's bound to use
and use is not working in scripting mode, you can use following commands to manage default:
rvm alias delete default
rvm alias create default 1.9.3
And to make it effective (replacement for rvm use default
):
source $(rvm default do rvm env --path)
I had the same problem and found this made my day:
sudo rvm alias create default <ruby-version>
and/or
rvm use <ruby-version> --default
This worked for me changing the default to 1.9.3
Try rvm --default (not rvm use --default ). It worked for me
rvm list
rvm rubies
ruby-1.9.2-p318 [ x86_64 ]
=* ruby-1.9.3-p125 [ x86_64 ]
# => - current
# =* - current && default
# * - default
You can see that 1.9.3 is the default now
rvm --default ruby-1.9.2-p318
rvm list
rvm rubies
=* ruby-1.9.2-p318 [ x86_64 ]
ruby-1.9.3-p125 [ x86_64 ]
# => - current
# =* - current && default
# * - default
You get this behaviour when RVM doesn't have write permissions on ~/.rvm
Fix it like this: (after switching in your usercode / group of course)
sudo chown -R nick:staff ~/.rvm