RVM finding system gems' executables?

Explanation of rubygems bin folders and PATH Oh. You didn't have rails installed in your rvm ruby, but you did in your system ruby Individual gems, like rails can have a bin directory that will contain executable helper scripts. Your system default rubygems is making symlinks from your system /usr/bin/ dir into the gem's bin folder for these helper executables RVM provides a similar facility, except instead of polluting the system /usr/bin dir, it just appends its ~/.

Rvm/gems/#{rvm_gemset_string}/bin folder to the PATH environment variable Importing system Rubygems list into your new rvm rubies' gem directories RVM by default will not import your gems from your system ruby installation into your rvm ruby installs. It makes a full clean fork of the entire ruby system including rubygems (the gem 'rubygems') and rubygems' gem list. When you rvm install 1.9.2 it's like you've made a completely new install of everything used with ruby If you'd like to get all your system ruby gems that you were previously using into your preferred rvm ruby, try this: 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/ Edits from @Telemachus Try moving the lines that source rvm to the end of your ~/. Bash_profile or ~/.

Bashrc (whichever you have it in): -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 before the rvm ruby bin path in your bash echo $PATH variable, so it's finding the system rails install (/usr/bin/rails, a ruby script) which starts like this:! /usr/bin/ruby18 You've gotta make the conflict stop happening, the best of all possible ways is making sure that RVM's 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 rather than just for your user, this will be different If you get to that case, ask @Telemachus You'll then need to ensure you've gotten the rails gem installed in your new rvm ruby as above Acceptance Test: You'll find that when you've done 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.

Explanation of rubygems bin folders and PATH Oh. You didn't have rails installed in your rvm ruby, but you did in your system ruby. Individual gems, like rails can have a bin directory that will contain executable helper scripts.

Your system default rubygems is making symlinks from your system /usr/bin/ dir into the gem's bin folder for these helper executables. RVM provides a similar facility, except instead of polluting the system /usr/bin dir, it just appends its ~/. Rvm/gems/#{rvm_gemset_string}/bin folder to the PATH environment variable.

Importing system Rubygems list into your new rvm rubies' gem directories RVM by default will not import your gems from your system ruby installation into your rvm ruby installs. It makes a full clean fork of the entire ruby system including rubygems (the gem 'rubygems') and rubygems' gem list. When you rvm install 1.9.2 it's like you've made a completely new install of everything used with ruby.

If you'd like to get all your system ruby gems that you were previously using into your preferred rvm ruby, try this: 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/ Edits from @Telemachus Try moving the lines that source rvm to the end of your ~/.

Bash_profile or ~/. Bashrc (whichever you have it in): ' -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 before the rvm ruby bin path in your bash echo $PATH variable, so it's finding the system rails install (/usr/bin/rails, a ruby script) which starts like this: #!

/usr/bin/ruby18 You've gotta make the conflict stop happening, the best of all possible ways is making sure that RVM's 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 rather than just for your user, this will be different. If you get to that case, ask @Telemachus. You'll then need to ensure you've gotten the rails gem installed in your new rvm ruby as above.

Acceptance Test: You'll find that when you've done 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.

Done the mv, and this happens The program 'rails' is currently not installed. You can install it by typing: sudo apt-get install rails – Tong Lu Kim Jun 17 at 13:43 after renaming, I installed it using gem install rails again, and it worked, thanks! – Tong Lu Kim Jun 17 at 13:57 Please see the updated answer showing how to copy your system gems into rvm.

– Tim Snowhite Jun 17 at 15:42 1 As for the $PATH, rvm recommends that you source it very late (ideally last) in your shell's start-up files in order to make sure that rvm installed items come first. That way, there's never a need to mv things out of the way as you suggest. (You really should remove that suggestion.) – Telemachus Jun 17 at 15:53 1 +1 In general, you shouldn't have to touch system-installed items at all to work with rvm.

So rather than renaming rails, I think the real answer is (1) install rails under the rvm-installed 1.9.2 and (2) make sure your $PATH is set correctly (that is, with rvm items before OS items). – Telemachus Jun 17 at 15:59.

I just solved the same problem on Windows Vista. My console was giving 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 made it point to the correct location for ruby.

Exe, on my system, like this: #! C:\RailsInstaller\Ruby1.9.2\bin\ruby. Exe Et voilà , problem solved!

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

That's what I did..but nothing – Tong Lu Kim Jun 17 at 1:20.

You didn't have rails installed in your rvm ruby, but you did in your system ruby. Individual gems, like rails can have a bin directory that will contain executable helper scripts. Your system default rubygems is making symlinks from your system /usr/bin/ dir into the gem's bin folder for these helper executables.

RVM provides a similar facility, except instead of polluting the system /usr/bin dir, it just appends its ~/. Rvm/gems/#{rvm_gemset_string}/bin folder to the PATH environment variable. RVM by default will not import your gems from your system ruby installation into your rvm ruby installs.

It makes a full clean fork of the entire ruby system including rubygems (the gem 'rubygems') and rubygems' gem list. When you rvm install 1.9.2 it's like you've made a completely new install of everything used with ruby. Try moving the lines that source rvm to the end of your ~/.

Bash_profile or ~/. You've gotta make the conflict stop happening, the best of all possible ways is making sure that RVM's 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 rather than just for your user, this will be different. If you get to that case, ask @Telemachus.

You'll then need to ensure you've gotten the rails gem installed in your new rvm ruby as above. You'll find that when you've done 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 ~/.

Explanation of rubygems bin folders and PATH.

I just solved the same problem on Windows Vista.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions