title: Ruby gems path issue (system vs brew)
body: <p>I'm having an issue with homebrew looking to the system gems when the system gems aren't in the $PATH.</p>
  
  <p>Here is my <code>gem env</code> to show that my gems are installed in my .rvm/gems directory:</p>
  
  <pre><code>    RubyGems Environment:
    - RUBYGEMS VERSION: 2.4.5
    - RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x86_64-darwin14]
    - INSTALLATION DIRECTORY: /Users/scott/.rvm/gems/ruby-2.2.2
    - RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
    - EXECUTABLE DIRECTORY: /Users/scott/.rvm/gems/ruby-2.2.2/bin
    - SPEC CACHE DIRECTORY: /Users/scott/.gem/specs
    - SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.2.2/etc
    - RUBYGEMS PLATFORMS:
      - ruby
      - x86_64-darwin-14
    - GEM PATHS:
       - /Users/scott/.rvm/gems/ruby-2.2.2
       - /Users/scott/.rvm/gems/ruby-2.2.2@global
    - GEM CONFIGURATION:
       - :update_sources =&gt; true
       - :verbose =&gt; true
       - :backtrace =&gt; false
       - :bulk_threshold =&gt; 1000
       - :sources =&gt; ["http://gems.rubyforge.org/", "http://gems.github.com"]
       - :benchmark =&gt; false
       - "gem" =&gt; "--no-ri --no-rdoc"
    - REMOTE SOURCES:
       - http://gems.rubyforge.org/
       - http://gems.github.com
    - SHELL PATH:
       - /Users/scott/.rvm/gems/ruby-2.2.2/bin
       - /Users/scott/.rvm/gems/ruby-2.2.2@global/bin
       - /Users/scott/.rvm/rubies/ruby-2.2.2/bin
       - /usr/local/bin
       - /usr/bin
       - /bin
       - /usr/sbin
       - /sbin
       - /opt/X11/bin
       - /Users/scott/.rvm/bin
       - /Users/scott/.composer/vendor/bin
       - /usr/local/sbin
  </code></pre>
  
  <p>Now here is the error message I keep getting on various commands (this in particular was from <code>brew services start httpd22</code>):</p>
  
  <pre><code>Error: ERROR: Failed to build gem native extension.
  
      /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
  Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin14.3.0/ports/libxml2/2.8.0... OK
  Running 'compile' for libxml2 2.8.0... ERROR, review 'tmp/x86_64-apple-darwin14.3.0/ports/libxml2/2.8.0/compile.log' to see what happened.
  /Library/Ruby/Gems/2.0.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:265:in `block in execute': Failed to complete compile task (RuntimeError)
      from /Library/Ruby/Gems/2.0.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:257:in `chdir'
      from /Library/Ruby/Gems/2.0.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:257:in `execute'
      from /Library/Ruby/Gems/2.0.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:69:in `compile'
      from /Library/Ruby/Gems/2.0.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:109:in `cook'
      from extconf.rb:101:in `block in &lt;main&gt;'
      from extconf.rb:119:in `call'
      from extconf.rb:119:in `block in &lt;main&gt;'
      from extconf.rb:109:in `tap'
      from extconf.rb:109:in `&lt;main&gt;'
  
  extconf failed, exit code 1
  
  Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.1 for inspection.
  Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/nokogiri-1.6.1/gem_make.out
  </code></pre>
  
  <p>See how it's looking to the system version of Ruby &amp; Gems? I have XCode installed and up to date.</p>
  
  <p><code>brew doctor</code> yields no results and <code>brew update</code> is ready to brew.</p>
  
  <p>I'm using OS 10.10.3. Anything I've left out, just ask.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Here is my .zshrc $PATH export:</p>
  
  <pre><code>export PATH="$PATH:$HOME/.composer/vendor/bin"
  export PATH="$PATH:/usr/local/sbin"
  export PATH="$PATH:$HOME/.rvm/bin"
  </code></pre>
  
  <p><strong>EDIT 2</strong></p>
  
  <p><code>$GEM_HOME</code></p>
  
  <pre><code>/Users/scott/.rvm/gems/ruby-2.2.2
  </code></pre>
  
  <p><code>$GEM_PATH</code></p>
  
  <pre><code>/Users/scott/.rvm/gems/ruby-2.2.2:/Users/scott/.rvm/gems/ruby-2.2.2@global
  </code></pre>
  
  <p>Thoughts?</p>