I have scripts that use "#!/usr/bin/env ruby" but I've switched to using Ruby Enterprise Edition instead of the default ruby that is included with Ubuntu server. Thus, the scripts freak out when I try to run them. How can I add the Ruby EE path to /usr/bin/env?
#!/usr/bin/env ruby
is similar to simply calling ruby
from the command line, so the same rules apply. Basically, the individual entries in the $PATH
environment variable are checked in order, and the ruby
that is found first is used. So make sure that the ruby
for Ruby EE is earlier in the search path order than your other ruby
s.
I'm not familiar with Ruby EE, so if it doesn't have an executable called ruby
, just create a symlink in a directory that's early in your search path to Ruby EE's executable.
See section 1.6 in the Ruby EE documentation page: http://www.rubyenterpriseedition.com/documentation.html
For a system wide change you can update your PATH in the /etc/environment file to include the Ruby EE bin directory. Maybe something like this:
PATH="/opt/ruby-enterprise-x.x.x/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
If you only want to the change to be visible for one user on the system you can update your .bashrc or .profile with the correct path.
Make sure to include the REE path first in the list of directories.
Since you have an explicit dependency on Ruby EE, you could always modify the scripts instead of your environment ( which could have other unintended consequences ).
#!/usr/bin/env ruby
becomes
#!/path/to/enterprise/edition/ruby
Now it becomes clear to the reader that you using a specific version of ruby rather than just whatever ruby is in your path.
I posted the solution I used on Ubuntu here: http://groups.google.com/group/emm-ruby/browse_thread/thread/d0c685bbd096823a#msg_effa7d6ad42c541c
There were some additional steps to get it working beyond what was described in the Ruby Enterprise Edition documentation.