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 .