Which Ruby is my Rails using?

I just noticed something.

I’m running OS X and I’ve installed/updated Ruby to 1.8.4 using the
HiveLogic instructions.

In generating a new app, I noticed that the dispatch.cgi,
dispatch.fcgi and dispatch.rb all start with:

#!/usr/bin/ruby

and not

#!/usr/bin/env ruby

The script/server file does use ‘env’.

Now, how will this impact how Rails is run? Will it use the Ruby 1.8.2
that’s preinstalled by OS X or use 1.8.4 that I loaded (in
/usr/local/bin)?

Should I make sure to change the three dispatch lines to /usr/bin/env
ruby ?

I’m sort of surprised this hasn’t come up ( or maybe it has and I’ve
missed it…)

Thanks,

jt

John T. wrote:
[ . . . ]

In generating a new app, I noticed that the dispatch.cgi,
dispatch.fcgi and dispatch.rb all start with:

#!/usr/bin/ruby

These will all use the default system broked 1.8.2 version.

and not

#!/usr/bin/env ruby

This will use whatever copy occurs first in the directories in your
PATH. While it may be “right” from your shell it may not be from, say,
FCGI or CGI running under apache (if you let the system start apache at
boot time without modifying things).

Now, how will this impact how Rails is run? Will it use the Ruby 1.8.2
that’s preinstalled by OS X or use 1.8.4 that I loaded (in
/usr/local/bin)?

Should I make sure to change the three dispatch lines to /usr/bin/env
ruby ?

I personally tend to hard code them to the /usr/local/bin version. Just
remember that you’ve done so if you move things to another server
(because I of course forgot when I rsync’d to my hosting company . . .
grrr).

On 4/14/06, Mike F. [email protected] wrote:

#!/usr/bin/env ruby

This will use whatever copy occurs first in the directories in your
PATH. While it may be “right” from your shell it may not be from, say,
FCGI or CGI running under apache (if you let the system start apache at
boot time without modifying things).

Yeah, I did know the difference between the two formats. In running
local and using script/server (which launches lighttpd), I was just
curious which Ruby was being used. … since I went through the trouble
of installing the updated version, I’d like to make sure that it’s
used :wink:

I personally tend to hard code them to the /usr/local/bin version. Just
remember that you’ve done so if you move things to another server
(because I of course forgot when I rsync’d to my hosting company . . .
grrr).

Cool, thanks. Something to watch out for, I guess.