title: RVM gem permissions error
body: <p>I started trying to set up a local rails installation for development.  After I installed in using <code>apt-get</code>, however, I learned about RVM, so I removed the earlier one, and reinstalled from RVM.  It looks like I have residual problems, though.  Specifically, when I try to install rails I get...</p>
  
  <pre><code>$ gem install rails
  ERROR:  While executing gem ... (Gem::FilePermissionError)
      You don't have write permissions into the /var/lib/gems/1.9.1 directory.
  </code></pre>
  
  <p>This already looks like a problem, because I don't want it to be in the /var/ directory, I want it to be in the user directory.  So, I check the following...</p>
  
  <pre><code>$ gem env
  RubyGems Environment:
    - RUBYGEMS VERSION: 1.8.11
    - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-linux]
    - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
    - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
    - EXECUTABLE DIRECTORY: /usr/local/bin
    - RUBYGEMS PLATFORMS:
      - ruby
      - x86_64-linux
    - GEM PATHS:
       - /var/lib/gems/1.9.1
       - /home/myusername/.gem/ruby/1.9.1
    - GEM CONFIGURATION:
       - :update_sources =&gt; true
       - :verbose =&gt; true
       - :benchmark =&gt; false
       - :backtrace =&gt; false
       - :bulk_threshold =&gt; 1000
    - REMOTE SOURCES:
       - http://rubygems.org/
  </code></pre>
  
  <p>As well as sudo'd:</p>
  
  <pre><code>$ sudo gem env
  RubyGems Environment:
    - RUBYGEMS VERSION: 1.8.11
    - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-linux]
    - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
    - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
    - EXECUTABLE DIRECTORY: /usr/local/bin
    - RUBYGEMS PLATFORMS:
      - ruby
      - x86_64-linux
    - GEM PATHS:
       - /var/lib/gems/1.9.1
       - /home/myusername/.gem/ruby/1.9.1
    - GEM CONFIGURATION:
       - :update_sources =&gt; true
       - :verbose =&gt; true
       - :benchmark =&gt; false
       - :backtrace =&gt; false
       - :bulk_threshold =&gt; 1000
    - REMOTE SOURCES:
       - http://rubygems.org/
  </code></pre>
  
  <p>gems seem to live in /var/lib for some reason.  Is this normal?  How can I fix this so I can install the rails gem?</p>
  
  <p><strong>EDIT: UPDATE!</strong></p>
  
  <p>It appears to me that I have gems installed twice, once in /var/lib/gems/1.9.91 (bad) and once in /home/myusername/.gem/ruby/1.9.1 (good).</p>
  
  <p>I think what is happening here is that when I type "gem" the installation in /var/lib/gems/1.9.1 (bad) is taking priority over /home/myusername/.gem/ruby/1.9.1 (good).  Can anyone confirm that?  Also, would it be OK and fix things just to delete the bad directory, or would that cause problems?</p>