title: Bundler cannot install any gems without sudo
body: <p>I'm trying to install a rails app and every time I use <code>bundle</code> it fails without <code>sudo</code>. My current situation is that everything works as long as use <code>sudo</code> for <em>everything</em>, including rails. I don't think this is correct.</p>
  
  <p>For example:</p>
  
  <pre><code>$ bundle update
  Updating git://github.com/refinery/refinerycms.git
  Fetching gem metadata from https://rubygems.org/.......
  Fetching gem metadata from https://rubygems.org/..
  Resolving dependencies...
  Enter your password to install the bundled RubyGems to your system: 
  Using rake (10.0.4) 
  Using i18n (0.6.1) 
  Using multi_json (1.7.2) 
  Using rack-cache (1.2) 
  Using rack-test (0.6.2) 
  Installing hike (1.2.2) 
  Errno::EACCES: Permission denied - /usr/local/rvm/gems/ruby-1.9.3-p194/build_info/hike-1.2.2.info
  An error occurred while installing hike (1.2.2), and Bundler cannot continue.
  Make sure that `gem install hike -v '1.2.2'` succeeds before bundling.
  </code></pre>
  
  <p>But then I do what it says and it works:</p>
  
  <pre><code>$ gem install hike -v '1.2.2' 
  Successfully installed hike-1.2.2
  Parsing documentation for hike-1.2.2
  Installing ri documentation for hike-1.2.2
  Done installing documentation for hike after 0 seconds
  1 gem installed
  </code></pre>
  
  <p>This pattern repeats again and again for different gems. I don't get it. Why is this happening? If I use <code>sudo</code> bundle will update without this error. But the current situation is that I need <code>sudo</code> for everything, including <code>rake...</code> or <code>rails server</code>, etc. Something isn't right.</p>
  
  <p>Additional details: I'm on OSX 10.8.3...</p>
  
  <pre><code>$ ruby -v
  ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
  $ gem -v
  2.0.3
  $ rvm -v
  rvm 1.19.6 (stable) by Wayne E. Seguin &lt;wayneeseguin@gmail.com&gt;, Michal Papis &lt;mpapis@gmail.com&gt; [https://rvm.io/]
  
  $ which ruby
  /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby
  $ which gem
  /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/gem
  $ which rvm
  /usr/local/rvm/bin/rvm
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>It may be informative that I can run <code>sudo bundle install</code> with no errors. Then immediately after <code>bundle install</code> fails with an error like you see above. Why is this?</p>
  
  <p><strong>Update2</strong></p>
  
  <pre><code>/usr/local/rvm[master]$ ls -l
  total 56
  -rw-rw-r--   1 root  rvm   566 May  4 12:59 LICENCE
  -rw-rw-r--   1 root  rvm  8929 May  4 12:59 README
  -rw-rw-r--   1 root  rvm     7 May  4 12:59 RELEASE
  -rw-rw-r--   1 root  rvm     7 May  4 12:59 VERSION
  drwxrwsr-x   3 root  rvm   102 May  4 01:34 archives
  drwxrwsr-x  35 root  rvm  1190 May  4 12:59 bin
  drwxrwsr-x  11 root  rvm   374 May  4 12:59 config
  drwxrwsr-x   6 root  rvm   204 Jan 10 19:55 contrib
  drwxrwsr-x   5 root  rvm   170 Jan 10 19:55 environments
  drwxrwsr-x   3 root  rvm   102 Jan 10 19:55 examples
  drwxrwsr-x   5 root  rvm   170 Jan 10 19:52 gems
  drwxrwxr-x   6 ESL   rvm   204 May  4 12:59 gemsets
  drwxrwsr-x  92 root  rvm  3128 May  4 01:34 help
  drwxrwsr-x  11 root  rvm   374 May  4 01:34 hooks
  -rw-rw-r--   1 root  rvm    11 May  4 12:59 installed.at
  drwxrwsr-x   4 root  rvm   136 Jan 10 19:54 lib
  drwxrwsr-x   5 root  rvm   170 May  4 12:55 log
  drwxrwsr-x   2 root  rvm    68 Jan 10 19:52 man
  drwxrwsr-x   9 root  rvm   306 Jan 10 19:52 patches
  drwxrwxr-x   4 ESL   rvm   136 May  4 12:59 patchsets
  drwxrwsr-x   4 root  rvm   136 Jan 10 19:55 rubies
  drwxrwsr-x  64 root  rvm  2176 May  4 01:34 scripts
  drwxrwsr-x   3 root  rvm   102 May  4 01:34 src
  drwxrwsr-x   2 root  rvm    68 Jan 10 19:52 tmp
  drwxrwsr-x   8 root  rvm   272 May  4 12:59 user
  drwxrwsr-x   4 root  rvm   136 Jan 10 19:52 usr
  drwxrwsr-x   5 root  rvm   170 Jan 10 19:55 wrappers
  </code></pre>