title: Setting up RVM for gem installs in future for correct permissions and adding PATH correctly
body: <p>I have scoured the internet for answers. I feel I have not followed the right way to do things and just want to set up my rvm environment in the proper way. This all stemmed from me having to use <code>sudo gem install sass</code> to install SASS which I didn't want to do.</p>
  
  <p>Now when I do <code>gem install sass</code> I get:</p>
  
  <pre><code>ERROR:  While executing gem ... (Gem::FilePermissionError)
      You don't have write permissions for the /usr/bin directory.
  </code></pre>
  
  <p>Steps I took:</p>
  
  <pre><code>sudo chown -R dhruv: /Library/Ruby/Gems/2.0.0
  \curl -sSL https://get.rvm.io | bash -s stable --ruby
  brew install gnupg gnupg2
  gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
  sudo chown -R dhruv:staff ~/.rvm
  sudo chown -R dhruv:staff ~/.gem
  sudo chown -R dhruv:staff /Library/Ruby/Gems/2.0.0
  </code></pre>
  
  <p>Note that <code>which rvm</code> doesn't return anything, even though running the curl command above gave me:</p>
  
  <pre><code>Upgrading the RVM installation in /Users/dhruv/.rvm/
      RVM PATH line found in /Users/dhruv/.mkshrc /Users/dhruv/.profile /Users/dhruv/.bashrc /Users/dhruv/.zshrc.
      RVM sourcing line found in /Users/dhruv/.profile /Users/dhruv/.bash_profile /Users/dhruv/.zlogin.
  Upgrade of RVM in /Users/dhruv/.rvm/ is complete.
  
  # dhruvghulati,
  #
  #   Thank you for using RVM!
  #   We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
  #
  # ~Wayne, Michal &amp; team.
  </code></pre>
  
  <p>I want to get things to a state where I can install gems easily without sudo. How do I do this?</p>
  
  <p>Also, how do I prevent these PATH errors I am seeing for <code>rvm</code>?</p>
  
  <p>Also I am worried about when I did <code>sudo chown -R dhruv:staff /Library/Ruby/Gems/2.0.0</code>, the internet seems to say this is a terrible evil and I will have to revert back? Can I revert this to maybe <code>chmod</code> to the original user this should be owned by?</p>
  
  <hr>
  
  <p>Here is the output of <code>rvm info</code>:</p>
  
  <pre><code>Warning! PATH is not properly set up, '/Users/dhruv/.rvm/gems/ruby-2.2.1/bin' is not at first place,
           usually this is caused by shell initialization files - check them for 'PATH=...' entries,
           it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
           to fix temporarily in this shell session run: 'rvm use ruby-2.2.1'.
  
  ruby-2.2.1:
  
    system:
      uname:       "Darwin Dhruvs-MacBook-Pro-2.local 14.5.0 Darwin Kernel Version 14.5.0: Tue Sep  1 21:23:09 PDT 2015; root:xnu-2782.50.1~1/RELEASE_X86_64 x86_64"
      system:      "osx/10.10/x86_64"
      bash:        "/bin/bash =&gt; GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)"
      zsh:         "/bin/zsh =&gt; zsh 5.0.5 (x86_64-apple-darwin14.0)"
  
    rvm:
      version:      "rvm 1.26.11 (latest) by Wayne E. Seguin &lt;wayneeseguin@gmail.com&gt;, Michal Papis &lt;mpapis@gmail.com&gt; [https://rvm.io/]"
      updated:      "1 day 8 minutes 30 seconds ago"
      path:         "/Users/dhruv/.rvm"
  
    ruby:
      interpreter:  "ruby"
      version:      "2.2.1p85"
      date:         "2015-02-26"
      platform:     "x86_64-darwin14"
      patchlevel:   "2015-02-26 revision 49769"
      full_version: "ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]"
  
    homes:
      gem:          "/Users/dhruv/.rvm/gems/ruby-2.2.1"
      ruby:         "/Users/dhruv/.rvm/rubies/ruby-2.2.1"
  
    binaries:
      ruby:         "/Users/dhruv/.rvm/rubies/ruby-2.2.1/bin/ruby"
      irb:          "/Users/dhruv/.rvm/rubies/ruby-2.2.1/bin/irb"
      gem:          "/Users/dhruv/.rvm/rubies/ruby-2.2.1/bin/gem"
      rake:         "/Users/dhruv/.rvm/rubies/ruby-2.2.1/bin/rake"
  
    environment:
      PATH:         "/Users/dhruv/anaconda/bin:/Users/dhruv/anaconda/bin:/Users/dhruv/.rvm/gems/ruby-2.2.1/bin:/Users/dhruv/.rvm/gems/ruby-2.2.1@global/bin:/Users/dhruv/.rvm/rubies/ruby-2.2.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Users/dhruv/.gem/ruby/2.0.0/bin:/Users/dhruv/scripts:/Users/dhruv/.rvm/bin:/Users/dhruv/.rvm/bin:/usr/local/lib:/Users/dhruv/.gem/ruby/2.0.0/bin:/Users/dhruv/scripts:/Users/dhruv/.rvm/bin:/Users/dhruv/.rvm/bin:/usr/local/lib"
      GEM_HOME:     "/Users/dhruv/.rvm/gems/ruby-2.2.1"
      GEM_PATH:     "/Users/dhruv/.rvm/gems/ruby-2.2.1:/Users/dhruv/.rvm/gems/ruby-2.2.1@global"
      MY_RUBY_HOME: "/Users/dhruv/.rvm/rubies/ruby-2.2.1"
      IRBRC:        "/Users/dhruv/.rvm/rubies/ruby-2.2.1/.irbrc"
      RUBYOPT:      ""
      gemset:       ""
  </code></pre>
  
  <p>The command <code>gem install --user-install sass</code> gives me:</p>
  
  <pre><code>WARNING:  You don't have /Users/dhruv/.gem/ruby/2.2.0/bin in your PATH,
        gem executables will not run.
  Successfully installed sass-3.4.21
  Parsing documentation for sass-3.4.21
  Done installing documentation for sass after 4 seconds
  1 gem installed
  </code></pre>
  
  <p>.bash_profile:</p>
  
  <pre><code>export PATH=$PATH:~/.gem/ruby/2.0.0/bin
  export SBT_OPTS="-Xmx2G -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=2G -Xss2M  -Duser.timezone=GMT"
  export PATH=$PATH:~/scripts
  source ~/.profile
  source ~/.bashrc
  export PATH=$PATH:/usr/local/lib
  # added by Anaconda3 2.3.0 installer
  export PATH="/Users/dhruv/anaconda/bin:$PATH"
  export MONGO_PATH=/usr/local
  
  [[ -s "$HOME/.rvm/scripts/rvm" ]] &amp;&amp; source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
  </code></pre>
  
  <p>.bashrc:</p>
  
  <pre><code>export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
  [[ -s "$HOME/.rvm/scripts/rvm" ]] &amp;&amp; source "$HOME/.rvm/scripts/rvm"
  </code></pre>
  
  <p>.profile:</p>
  
  <pre><code>export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
  
  [[ -s "$HOME/.rvm/scripts/rvm" ]] &amp;&amp; source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
  </code></pre>