title: Change gem env RUBY EXECUTABLE path for one command
body: <p>I would like to run gem commands, such as <code>gem install</code>, with a different ruby version than what is listed in <code>gem env</code>. The Ruby version I want to use is a pre-compiled version which I have the path for, so installing and using another version from RVM or similar would not solve my problem.</p>
  
  <p>I do not want to change the <code>RUBY EXECUTABLE</code> permanently, just for one command at a time. I have tried to set <code>GEM_HOME</code>, <code>GEM_PATH</code>, <code>PATH</code>, <code>RUBY</code> and more. I have tried firing up gem with <code>specific/version/of/ruby/path/ruby path/to/gem env</code>, but I still get the default Ruby in my <code>RUBY EXECUTABLE</code> variable. </p>
  
  <p>I even tried setting<code>RUBY_EXECUTABLE=/path/to/correct/ruby</code>, which also did not work.</p>
  
  <p>What really surprised me was that when I edited the shebang in the <code>path/to/gem</code> file itself so it pointed to the correct Ruby, it still did not work! What is up with that?!</p>
  
  <p>How can I change this variable so I can use gem goodness with my custom compiled Ruby?</p>
  
  <hr>
  
  <p>This one is really beating me. I have now updated my <code>rbconfig.rb</code> to point to the desired Ruby path. I have looked at the rubygems source and replaced every single instance of the default ruby , in all the files I could find,  with the path to the one I want. Even this did not set the environment correctly. Is this somehow hard-coded into the compiled ruby? If that is the case, why the star*4 is this done?</p>