HanXu
HanXu

Reputation: 5597

RVM can not change gemset

Before I installed MySQL and restart my computer, my RVM works well.

If I type

rvm gemset use rails

It will show:

Using ruby-1.9.3-p194 with gemset rails

and then I type:

rvm gemset name

It shows:

rails

which is correct.

However, after I restart my computer, something strange happens.

Firstly, the system cannot find the command 'rvm', so I modified by ~/.bash_profile:

export PATH=/usr/local/mysql/bin:/Users/hanxu/.rvm/bin/:$PATH

Above is the content of my .bash_profile

Then rvm works.

Then I type:

rvm gemset use rails

It seems running well and shows:

Using ruby-1.9.3-p194 with gemset rails

However, when I examine it by asking rvm gemset name, it turns to be:

/Users/hanxu/.rvm/gems/ruby-1.9.3-p194

which is my default gemset, rather than "rails".

No matter how I set gemset, it always change to the default setting.

Can anyone tell me what's the problam?

Upvotes: 0

Views: 1647

Answers (5)

Loren
Loren

Reputation: 3466

In my case, I needed to add the user to the rvm group before I could use rvm.

Upvotes: 0

Ramiz Raja
Ramiz Raja

Reputation: 6030

Use this command to switch gemset.

rvm use <ruby version>@<gemset name> --create

This command will switch rvm to given gemset and create it, if it does not exist.

Upvotes: 0

mpapis
mpapis

Reputation: 53158

rvm has a command to fix sourcing:

rvm get stable --auto

the auto switch will update your *rc files, then it should be enough to open new terminal and it should be all fine.

Upvotes: 1

Sergio Tulentsev
Sergio Tulentsev

Reputation: 230286

Your RVM installation is most likely incomplete. Look for this string in your .profile / .bashrc / .zshrc or whatever else you might be using

[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm

This command checks for existence of $HOME/.rvm/scripts/rvm and, if found, loads it into the shell. This effectively loads the RVM. So, if you don't find this command, add it and open a new terminal window, RVM should be there.

Upvotes: 1

pixelearth
pixelearth

Reputation: 14610

Are you using an .rvmrc file?

https://rvm.io/workflow/rvmrc/

Upvotes: 1

Related Questions