rvm .rvmrc file generation impossible

402 views Asked by At

I have created a rails3 app using rvm a few month ago. Everything works fine.

Now, I want to create another rails3 app. So I done :

$> rails new my_app

Everything works fine. Next, I wanted to link my app with rvm, so I tryed this:

$> ruby -v
   ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]
$> rvm install 1.9.3
$> rvm get head
$> rvm --rvmrc --create 1.9.3-p448@my_app (http://stackoverflow.com/questions/11138376/how-to-make-rvmrc-file-in-project-root-folder)

But I have got this error :

mkdir: cannot create directory `/usr/local/rvm/gems/ruby-1.9.3-p448@bcayi': Permission denied

Ok, permission denied, so I tryed:

$> rvmsudo --rvmrc --create 1.9.3-p448@my_app

And I have got this error:

sudo: invalid option -- '-'

So my question is : How to link rvm to my rails app ?

3

There are 3 answers

0
Jérémy Pouyet On BEST ANSWER

Problem solved !

Because the rvmsudo --rvmrc --create 1.9.3-p448@my_app failed, I have created the 1.9.3-p448@my_app directory manually :

$> sudo mkdir /usr/local/rvm/gems/ruby-1.9.3-p448@my_app

Then, I passed the ruby-1.9.3-p448@my_app directory in the rvm group :

$> sudo chown jeremy:rvm /usr/local/rvm/gems/ruby-1.9.3-p448@my_app
$> sudo chmod 755 /usr/local/rvm/gems/ruby-1.9.3-p448@my_app

Finally, I could create my gemset without rvmsudo :

$> cd my_app/
$> rvm gemset create my_app
$> rvm --rvmrc --create ruby-1.9.3-p448@my_app
$> cd .. ; cd my_app/
   You are using '.rvmrc' ...
3
mpapis On

because your RVM is installed in system (/usr/local/rvm vs. $HOME/.rvm) you need to be in rvm group (check with id) to be able to do things with rvm (like creating gemsets in this case).

To add yourself to rvm group run:

rvm group add rvm $USER

then you might need to restart your console / computer to make it work properly - sometimes OSX after freshly adding you to group will report it in id but it will be not effective till restart of computer (or relogin, but on OSX it's the same time).

2
dax On

try

sudo rvm --rvmrc --create 1.9.3-p448@my_app