Executing RVM Search Engine Executables

I installed RVM along with ruby ​​versions. However, if I started the console and started the command line server, installed the package, etc. I get this error

bash: /usr/bin/rails: /usr/bin/ruby1.8: bad interpreter: No such file or directory 

But if I started rvm use 1.9.2 , then everything will be fine. I tried to use `rvm use --default 1.9.2 ', but nothing has changed. Does this mean that RVM uses a different ruby? Thanks in advance!

+8
ruby ruby-on-rails rubygems rvm apt-get
source share
3 answers

Explanation of bin rubggems and PATH folders

A. You did not have rails installed in the rvm ruby, but you made a system in your ruby.

Individual gems, such as rails , may have a bin directory that will contain executable helper scripts. Your system’s runigems by default create symbolic links from your system / usr / bin / dir to the gem bin for these auxiliary binaries.

RVM provides a similar object, except that instead of polluting the / usr / bin dir system, it simply adds its ~/.rvm/gems/#{rvm_gemset_string}/bin to the PATH environment variable.


Import a list of Rubygems into your new gem rvm rubies directories

RVM will by default not import your gems from your ruby ​​installation into your ruby ​​ruby ​​installations. He makes a complete clean fork of the entire ruby ​​system, including rubigems (a rubigem gem) and a list of rubigem gems. When you rvm install 1.9.2 , it’s as if you made a completely new installation of everything that is used with ruby.

If you want to get all the ruby ​​jewels of your system that you previously used in your preferred rvm ruby, try the following:

  rvm use system rvm gemset export system.gems rvm use 1.9.2 rvm gemset import system.gems #You'll now have all your system gems reinstalled to your new ruby version 

Original answer / Editing @Telemachus

Try moving the lines with the original rvm to the end of your ~/.bash_profile or ~/.bashrc (depending on what you are there in it):

 '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' 

.

 bash: /usr/bin/rails: /usr/bin/ruby1.8: bad interpreter: No such file ... | | ^--------------------------------\ ^ Bash, not rvm; ^/usr/bin/rails, not ~/.rvm/gems/*/bin/rails; | Some ruby leftover from a previous install in the os 

You have rails installed in /usr/bin , which is probably up to the rvm ruby ​​bin path in your bash echo $PATH variable, so it detects the installation of system rails (/ usr / bin / rails, ruby), which starts as follows:

#! /usr/bin/ruby18

You must end the conflict, the best way is to make sure that the RVM bin dir is at the beginning of your PATH. This happens in the #Load rvm environment script that you added to your ~/.bash_profile when installing rvm. If you installed rvm as a system library, and not just for your user, this will be different.

If you get to this point, ask @Telemachus.

Then you need to make sure that you get the rails installed in the new rvm ruby, as described above.

Acceptance Test:

You will find that when you did rvm use 1.9.2 , then which ruby will return something like ~/.rvm/rubies/1.9.2/bin/ruby , and which rails should return something like ~/.rvm/gems/*/bin/rails .

+17
source share

I just solved the same problem on Windows Vista.

My console gave me this message:

 $ rails -v sh: /c/RailsInstaller/Ruby1.9.2/bin/rails: C:/Projects/railsinstaller/Stage/Ruby1.9.2 /bin/ruby.exe: bad interpreter: No such file or directory 

I just edited the first line of this file:

 C:\RailsInstaller\Ruby1.9.2\bin\rails 

And he pointed to the correct location of ruby.exe on my system, for example:

 #!C:\RailsInstaller\Ruby1.9.2\bin\ruby.exe 

Et voilĂ , the problem is solved!

+4
source share

You need to run rvm use --default 1.9.2 , not just rvm use --default .

0
source share

All Articles