4

Ikenna Okpala recommended this .gemrc (I modified it slightly):

---
:verbose: true
:bulk_threshold: 1000
install: --no-ri --no-rdoc --env-shebang
:sources:
- http://gems.rubyforge.org/
:benchmark: false
:backtrace: false
update: --no-ri --no-rdoc --env-shebang
:update_sources: true

I had not noticed the --env-shebang before. I looked up the documentation for --env-shebang at http://guides.rubygems.org/command-reference/:

Install/Update Options:
...
-E, -​-[no-]env-shebang - Rewrite the shebang line on installed scripts to use /usr/bin/env

Practically speaking, why might the --env-shebang option be important? (I've never used it.)

imz -- Ivan Zakharyaschev
  • 4,921
  • 6
  • 53
  • 104
David J.
  • 31,569
  • 22
  • 122
  • 174

2 Answers2

5

If for some reason the gem's author didn't use #!/usr/bin/env ruby you may well want to have it automatically changed.

(If you're asking why you'd want the env shebang line at all, this explains it pretty well.)

The beginning of the rubygems-developers thread discussing the idea for this feature is here.

Community
  • 1
  • 1
Darshan Rivka Whittle
  • 32,989
  • 7
  • 91
  • 109
2

/usr/bin/env is a Unix program that checks a user's path to see how a program should be run. Using /usr/bin/env allows the person using the program to be able to choose their own version of Ruby rather than the one that might happen to be installed by default on the system. Rather than hardcoding a location for Ruby, you can let the user decide where it is.

m-rod
  • 41
  • 6