Forum: Ruby on Rails Which Ruby is my Rails using?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
John T. (Guest)
on 2006-04-15 03:48
(Received via mailing list)
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
Mike F. (Guest)
on 2006-04-15 04:08
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*).
John T. (Guest)
on 2006-04-15 04:48
(Received via mailing list)
On 4/14/06, Mike F. <removed_email_address@domain.invalid> 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 ;)

> 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.
This topic is locked and can not be replied to.