<div dir="ltr"><div class="gmail_extra">It's been a while since I used rvm, so it may have changed, but here's what I think is happening.</div><div class="gmail_extra"><br></div><div class="gmail_extra">1. You install rvm and through it ruby 2.0.0-p247.  </div>
<div class="gmail_extra">2. You install rails 4.0.0 and this goes into the "ruby-2.0.0-p247" gem set.  </div><div class="gmail_extra" style>3. You create a new rails app using called r1</div><div class="gmail_extra" style>
4. You set a .rvmrc in this rails app to use a gem set called "r1".  This is really the "ruby-2.0.0-p247@r1" gem set.</div><div class="gmail_extra" style>5. When you change into the r1 directory rvm picks up the .rvmrc and switches you from the "ruby-2.0.0-p247" gem set (the default for your ruby 2.0.0-p247 install) to the "r1" gem set (full name "ruby-2.0.0-p47@r1").</div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style>The rails gem you installed in step 2. is not available in the r1 gem set (because the "ruby-2.0.0-p247" gem set and "ruby-2.0.0-p247@r1" gem sets don't share anything), so that's why typing rails in r1 directory is not using the rails 4 gem you installed earlier.</div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style>What makes it weird is that there is a gem set that is shared; each ruby install that rvm manages has a "@global" gem set (it usually contains rake and rdoc, maybe rubygems itself) (see: <a href="http://rvm.io/gemsets/global">http://rvm.io/gemsets/global</a>).  This gem set is different to the un-named gem set that you get when you just "rvm use ruby-2.0.0-p247".  If you want to  install gems to it specifically (for example, another gem that's useful to have in @global is bundler), you have to explicitly ask rvm to use it with "rvm use ruby-2.0.0-p247@global".</div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style>Of course, that's not just about gems that are installed. It's also about what binaries are available, so rvm manages your PATH variable to make sure that /bin from the @global gem set is available and also /bin from the current gem set is available too.</div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style>I mean, rvm does loads of other shell manipulation stuff.  It is useful to have separate paths and environments for each rails app as it isolates it and it's dependencies and thus makes it closer to the eventual production deployment environment.  Of course, without wanting to invite a holy war, it's worth noting that rvm and gem sets are not the only solution.  For example, without ditching rvm, you can ignore gem sets and just use bundler to install all the ruby dependencies locally to the application.  You might want to look at this article for some ideas: <a href="http://ryan.mcgeary.org/2011/02/09/vendor-everything-still-applies/">http://ryan.mcgeary.org/2011/02/09/vendor-everything-still-applies/</a></div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style>Hope some of that helps.</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>Cheers</div><div class="gmail_extra" style><br>
</div><div class="gmail_extra" style>Murray</div><div class="gmail_extra"><br><div class="gmail_quote">On 21 September 2013 22:35, gvim <span dir="ltr"><<a href="mailto:gvimrc@gmail.com" target="_blank">gvimrc@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I install Ruby 2.0.0 and Rails 4.0.0 via RVM on OS X 10.8 in my standard user account. Fine. I check my `ruby` and `rails` are both coming from the right place. Good so far:<br>

<br>
/Users/<me>/.rvm/rubies/ruby-<u></u>2.0.0-p247/bin/ruby<br>
/Users/<me>/.rvm/rubies/ruby-<u></u>2.0.0-p247/bin/rails<br>
<br>
Next, I create my first Rails app with `rails new r1` and inside the new r1 app directory I setup my .rvmrc with `rvm --rvmrc --create 2.0.0@r1` but `which rails` now returns  /usr/local/rails so I check my $PATH and discover that:<br>

<br>
/Users/<me>/.rvm/rubies/ruby-<u></u>2.0.0-p247/bin<br>
<br>
... had now become<br>
<br>
/Users/<me>/.rvm/rubies/ruby-<u></u>2.0.0-p247@global/bin<br>
<br>
... which explains why my newly installed rails binary can't be found<br>
<br>
So, 2 questions:<br>
<br>
1. Why has my rails path become screwed? Must I REALLY have a new PATH entry for every Rails app I create?<br>
2. What magic is Ruby/Rails/RVM using to alter my PATH because ~/.bashrc doesn't contain everything in $PATH and ~/.bash_profile only contains:<br>
<br>
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"<span class=""><font color="#888888"><br>
<br>
gvim<br>
______________________________<u></u>_________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org" target="_blank">Chat@lists.lrug.org</a><br>
<a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/<u></u>listinfo.cgi/chat-lrug.org</a><br>
</font></span></blockquote></div><br></div></div>