On Thu, Dec 19, 2013 at 8:41 AM, Peter Bailey <lists / ruby-forum.com> wrote:
>
> My shebank looks just like you suggest:
> #!/Users/peterbailey/.rbenv/shims/ruby
>
> If I were to use "#!/usr/bin/env ruby, would that still let me use the
> latest Ruby that's in /users/peterbailey/.rbenv/shims/ruby ??
>
> If so, then, yeh, I'll do that.
>
> Thanks!
>
>
If what you have for your shebang matches exactly what you get when you
type `which ruby` at the command line, that should work. If you want to try
out the other, you can also type that exactly at the command line.

This is mine:

$ which ruby
/opt/rubies/ruby-2.0.0-p247/bin/ruby

$ /opt/rubies/ruby-2.0.0-p247/bin/ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.5.0]

$ /usr/bin/env ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.5.0]
I happen to be using chruby, but rbenv and rvm will work the same if it is
set up correctly, as will the system ruby. Chruby sets and exports the
following into the shell environment (which is what /usr/bin/env picks up
for the shebang command):

GEM_HOME=/Users/tamara/.gem/ruby/2.0.0
GEM_PATH=/Users/tamara/.gem/ruby/2.0.0:/opt/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0
GEM_ROOT=/opt/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0
RUBYOPT=
RUBY_ENGINE=ruby
RUBY_ROOT=/opt/rubies/ruby-2.0.0-p247
RUBY_VERSION=2.0.0
You should be able to find the same env vars with settings appropriate to
your setup.