Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't change RVM default

Tags:

ruby

rvm

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.

like image 556
revolver Avatar asked May 17 '12 08:05

revolver


2 Answers

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)
like image 184
mpapis Avatar answered Oct 09 '22 21:10

mpapis


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

like image 40
nikek Avatar answered Oct 09 '22 21:10

nikek