title: Should rbenv be installed system-wide, or at a user level?
body: <p>I'm building a vagrant setup, and part of that is installing rbenv. I'm using librarian-chef to manage all my chef cookbooks, and it installs rbenv and ruby-build.</p>
  
  <p>However, when I tried to ssh into my Vagrant VM and type <code>ruby -v</code> I got the standard system-installed <code>ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]</code>. Thinking that maybe rbenv was not installed, I tried running <code>rbenv versions</code>, but rbenv was in fact installed:</p>
  
  <pre><code>vagrant@precise64:~$ rbenv versions
  * system (set by /opt/rbenv/version)
  </code></pre>
  
  <p>So then I tried <code>rbenv install [version]</code>:</p>
  
  <pre><code>vagrant@precise64:~$ rbenv install 1.9.3-p327
  [...]
  
  BUILD FAILED
  [...]
  
  test -z "/opt/rbenv/versions/1.9.3-p327/include" || /bin/mkdir -p "/opt/rbenv/versions/1.9.3-p327/include"
  /bin/mkdir: cannot create directory `/opt/rbenv/versions/1.9.3-p327': Permission denied
  </code></pre>
  
  <p>That failed with <code>Permission denied</code>. I tried installing again with <code>sudo</code>:</p>
  
  <pre><code>sudo rbenv install 1.9.3-p327
  </code></pre>
  
  <p>And that worked. Then I tried running <code>rbenv versions</code> again:</p>
  
  <pre><code>vagrant@precise64:~$ rbenv versions
  * system (set by /opt/rbenv/version)
  </code></pre>
  
  <p>But it still says only <code>system</code> ruby is installed. However, if I run it with <code>sudo</code>:</p>
  
  <pre><code>vagrant@precise64:~$ sudo rbenv versions
  * system (set by /home/vagrant/.rbenv/version)
    1.9.3-p327
  </code></pre>
  
  <p><code>rbenv versions</code> now shows <code>1.9.3</code> was installed.</p>
  
  <p>So there seems to be a disconnect, in that that rbenv and my ruby version are now installed on a system level and not on the user level.</p>
  
  <p>I am using the <a href="https://github.com/RiotGames/rbenv-cookbook" rel="nofollow noreferrer">rbenv-cookbook</a>. I would like to have rbenv set up with chef, because that saves me from setting it up manually, post-install.</p>
  
  <p>The other issue I'm having is that it seem like everything that is ruby-controlled, such as <code>gem</code>, is also suffering the same disconnect.</p>
  
  <pre><code>vagrant@precise64:~$ gem install bundler
  Fetching: bundler-1.3.5.gem (100%)
  ERROR:  While executing gem ... (Gem::FilePermissionError)
      You don't have write permissions into the /opt/vagrant_ruby/lib/ruby/gems/1.8 directory.
  </code></pre>