title: How to install, require, and use a gem in ruby
body: <p>I'm trying to use <code>rake</code> in my ruby script...(Ruby 1.8.6, JRuby 1.6.5)</p>
  
  <p>Downloaded rake using <code>gem install --remote rake</code>, looks ok on install...</p>
  
  <pre><code>Fetching: rake-0.9.2.2.gem (100%)
  Successfully installed rake-0.9.2.2
  1 gem installed
  </code></pre>
  
  <p>I've got a simple ruby script which works fine, but when I import <code>rake</code> to using any of the following <code>require</code>s, it starts complaining....</p>
  
  <pre><code>require 'rake'
  LoadError: no such file to load -- rake
    or
  require '/lib/rake'
  LoadError: no such file to load -- lib/rake
  </code></pre>
  
  <p>After some searching, I found that adding <code>require 'rubygems'</code> just before <code>rake</code>fixes the issue....</p>
  
  <pre><code>require 'rubygems'
  require 'rake'
  </code></pre>
  
  <p>Even though it's working, I've got some questions...</p>
  
  <ol>
  <li><p>The gem spec on <code>rake</code> shows the <code>require_path</code> as <code>lib</code>, so why
  doesn't <code>require '/lib/rake'</code> work? Am I misunderstanding the significance of <code>require_path</code>?</p></li>
  <li><p>Why is it necessary to place <code>require 'rubygems'</code> before <code>require
  'rake'</code></p></li>
  </ol>