Forum: Ruby Error after install

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.
641723483ce0aa7bfba494f615f01f79?d=identicon&s=25 Callen Mascarenhas (callenmas)
on 2008-12-23 05:02
I installed Ruby on my RHEL 3 system.  I did the following:
./configure
make
make test
make install

No errors in the whole process.  Now when I try to run irb in
/usr/local/bin/irb I'm gettin the following error:

$ . /usr/local/bin/irb
-bash: require: command not found
-bash: /usr/local/bin/irb: line 13: syntax error near unexpected token
`__FILE__'
-bash: /usr/local/bin/irb: line 13: `  IRB.start(__FILE__)'

Do I need to set up some $PATH info???  Or links to any shared
libraries???  There was nothing said in the ruby-lang.orb site.

Thanks in advance for you help
Callen.
E0c987f680cd640c14912ebfbf0f0f07?d=identicon&s=25 unknown (Guest)
on 2008-12-23 05:08
(Received via mailing list)
> Now when I try to run irb in
> /usr/local/bin/irb I'm gettin the following error:
>
> $ . /usr/local/bin/irb
    ^
> -bash: require: command not found
> -bash: /usr/local/bin/irb: line 13: syntax error near unexpected token
> `__FILE__'
> -bash: /usr/local/bin/irb: line 13: `  IRB.start(__FILE__)'

Instead of:
  . /usr/local/bin/irb
do:
  /usr/local/bin/irb
641723483ce0aa7bfba494f615f01f79?d=identicon&s=25 Callen Mascarenhas (callenmas)
on 2008-12-23 05:27
unknown wrote:
>> Now when I try to run irb in
>> /usr/local/bin/irb I'm gettin the following error:
>>
>> $ . /usr/local/bin/irb
>     ^
>> -bash: require: command not found
>> -bash: /usr/local/bin/irb: line 13: syntax error near unexpected token
>> `__FILE__'
>> -bash: /usr/local/bin/irb: line 13: `  IRB.start(__FILE__)'
>
> Instead of:
>   . /usr/local/bin/irb
> do:
>   /usr/local/bin/irb

when I do that and then run `which` I get the following.

$ which irb
/opt/third-party/bin/irb

That is why I'm using the . /usr/local/bin/irb command.  Am I not using
it correctly.

Thanks for your reply.
6e366eb5a71be2bad7f383d42aeb4788?d=identicon&s=25 Justin Collins (Guest)
on 2008-12-23 09:37
(Received via mailing list)
Callen Mascarenhas wrote:
>>> -bash: /usr/local/bin/irb: line 13: syntax error near unexpected token
>
> $ which irb
> /opt/third-party/bin/irb
>
> That is why I'm using the . /usr/local/bin/irb command.  Am I not using
> it correctly.
>
> Thanks for your reply.
>

Don't use the period at the beginning, that is what is screwing it up:

$ . /usr/bin/irb
bash: require: command not found
bash: /usr/bin/irb: line 13: syntax error near unexpected token
`__FILE__'
bash: /usr/bin/irb: line 13: `  IRB.start(__FILE__)'
$ /usr/bin/irb
irb(main):001:0>


-Justin
753dcb78b3a3651127665da4bed3c782?d=identicon&s=25 Brian Candler (candlerb)
on 2008-12-23 09:55
Callen Mascarenhas wrote:
>> Instead of:
>>   . /usr/local/bin/irb
>> do:
>>   /usr/local/bin/irb
>
> when I do that and then run `which` I get the following.
>
> $ which irb
> /opt/third-party/bin/irb
>
> That is why I'm using the . /usr/local/bin/irb command.  Am I not using
> it correctly.

No. A dot followed by a filename means "read this file into the shell" -
that is, it is treated as a series of bash commands.

Just doing /usr/local/bin/irb (without the dot) will execute that
command.
641723483ce0aa7bfba494f615f01f79?d=identicon&s=25 Callen Mascarenhas (callenmas)
on 2008-12-23 19:02
Brian Candler wrote:
> Callen Mascarenhas wrote:
>>> Instead of:
>>>   . /usr/local/bin/irb
>>> do:
>>>   /usr/local/bin/irb
>>
>> when I do that and then run `which` I get the following.
>>
>> $ which irb
>> /opt/third-party/bin/irb
>>
>> That is why I'm using the . /usr/local/bin/irb command.  Am I not using
>> it correctly.
>
> No. A dot followed by a filename means "read this file into the shell" -
> that is, it is treated as a series of bash commands.
>
> Just doing /usr/local/bin/irb (without the dot) will execute that
> command.

Thanks guys for replying.

The reason I'm using the ". /usr/local/bin/irb" is because I have
another company version of irb/ruby in /opt/third-party/bin/ and they
have removed the 'gem' command.  So I cannot install new features and
play with Ruby.

And if you look at the commands it is using the wrong irb i.e. the one
in /opt/third-party/bin/ which doesn't have the gem command and not the
one I just installed.  I hope this explains my predicament more clearly.
Bee69cfed999cd13e3bff73d472a39ee?d=identicon&s=25 Hassan Schroeder (Guest)
on 2008-12-23 19:45
(Received via mailing list)
On Tue, Dec 23, 2008 at 9:53 AM, Callen Mascarenhas
<callenmas@justice.com> wrote:

> The reason I'm using the ". /usr/local/bin/irb" is because I have
> another company version of irb/ruby in /opt/third-party/bin/ and they
> have removed the 'gem' command.  So I cannot install new features and
> play with Ruby.

You've already been told: the '.' is wrong, whether it's './' or '. /'
-- so
don't use it.

Entering /usr/local/bin/irb will use that exact version, and no, it
won't
change the result of `which irb` -- irrelevant.

If you want to use your personal version all the time, change the PATH
defined in .bashrc (or wherever) to put /usr/local/bin *first*, or at
least
before /opt/third-party/bin.

HTH,
641723483ce0aa7bfba494f615f01f79?d=identicon&s=25 Callen Mascarenhas (callenmas)
on 2008-12-23 20:20
Hassan Schroeder wrote:
> On Tue, Dec 23, 2008 at 9:53 AM, Callen Mascarenhas
> <callenmas@justice.com> wrote:
>
>> The reason I'm using the ". /usr/local/bin/irb" is because I have
>> another company version of irb/ruby in /opt/third-party/bin/ and they
>> have removed the 'gem' command.  So I cannot install new features and
>> play with Ruby.
>
> You've already been told: the '.' is wrong, whether it's './' or '. /'
> -- so
> don't use it.
>
> Entering /usr/local/bin/irb will use that exact version, and no, it
> won't
> change the result of `which irb` -- irrelevant.
>
> If you want to use your personal version all the time, change the PATH
> defined in .bashrc (or wherever) to put /usr/local/bin *first*, or at
> least
> before /opt/third-party/bin.
>
> HTH,

I guess I didn't really understand how the 'which' command worked.
Thanks for making things clear for me.

So out of curiosity, how come 'which' is pulling up the irb in
/opt/third-party/bin??  Is it because that is the first one in PATH ???
I know this is a Unix question.  But if someone can help, I can only be
grateful :).
3afd3e5e05dc9310c89aa5762cc8dd1d?d=identicon&s=25 Tim Hunter (Guest)
on 2008-12-23 20:48
(Received via mailing list)
Callen Mascarenhas wrote:
> So out of curiosity, how come 'which' is pulling up the irb in
> /opt/third-party/bin??  Is it because that is the first one in PATH ???
> I know this is a Unix question.  But if someone can help, I can only be
> grateful :).

At a command line type "man which". It'll explain to you exactly how the
which command works.
Bee69cfed999cd13e3bff73d472a39ee?d=identicon&s=25 Hassan Schroeder (Guest)
on 2008-12-23 20:51
(Received via mailing list)
On Tue, Dec 23, 2008 at 11:11 AM, Callen Mascarenhas
<callenmas@justice.com> wrote:

> So out of curiosity, how come 'which' is pulling up the irb in
> /opt/third-party/bin??  Is it because that is the first one in PATH ???

Exactly. Hence my suggestion that, if you want a different version to
be your own default, change your PATH.
641723483ce0aa7bfba494f615f01f79?d=identicon&s=25 Callen Mascarenhas (callenmas)
on 2008-12-24 02:12
Hassan Schroeder wrote:
> On Tue, Dec 23, 2008 at 11:11 AM, Callen Mascarenhas
> <callenmas@justice.com> wrote:
>
>> So out of curiosity, how come 'which' is pulling up the irb in
>> /opt/third-party/bin??  Is it because that is the first one in PATH ???
>
> Exactly. Hence my suggestion that, if you want a different version to
> be your own default, change your PATH.

Thanks guys for all your help.  I'll be back with more questions soon.
But I'm good for now.  Go Ruby!!!!
This topic is locked and can not be replied to.