title: ERROR: While executing gem ... (Errno::EISDIR) gem install rails
body: <p>I'm trying to install Ruby on rails, so first I installed RVM <code>rvm install 1.9.2</code>. After that install this <code>gem install rails</code>. It shows this error </p>
  
  <pre><code>ERROR:  While executing gem ... (Gem::FilePermissionError)
  You don't have write permissions into the /var/lib/gems/1.8 directory.
  </code></pre>
  
  <p>Then I used this <code>sudo chmod 0777 /var/lib/gems/1.8/</code> </p>
  
  <p>After that when I install, its showing this error:</p>
  
  <pre><code>ERROR:  While executing gem ... (Errno::EACCES)
  Permission denied - /var/lib/gems/1.8/cache/railties-3.2.2.gem
  </code></pre>
  
  <p>Then I run <code>sudo chmod 0777 /var/lib/gems/1.8/cache/railties-3.2.2.gem</code></p>
  
  <p>After that I install  <code>gem install rails</code>. Again its showing this error </p>
  
  <pre><code>ERROR:  While executing gem ... (Errno::EISDIR)
  Is a directory - /var/lib/gems/1.8/cache/railties-3.2.2.gem
  </code></pre>