Une bÃ©vue wrote:
So there is nothing wrong with the syntax in the line creating the error
OK then we agree…
We agree that the line should not have produced an error. We apparently
don’t agree that your setup (multiple Ruby versions and no clear way to
distinguish between them) caused the problem.
Re-install Mac OS X if you have to. Not being able to post your code as
written is very serious. Not being able to cut and paste is even more
That only in my account if i add another one, for this new account,
cut’n paste and drag’n drop are working as expected…
Then the problem is limited to your user space. Remedy: back up all your
user files, delete your user account, reestablish it, restore your
This may be the problem – the code
in your programming editor may not be identical to the code you have
posted, because the code you posted runs fine.
yes my code works fine even on another computer which i don’t know the
OS version nor the ruby version.
Okay. Two facts:
Your code doesn’t work on your machine, but it works on another
The way you have of installing and using multiple Ruby versions is
One of these facts isn’t a fact.
someone gave me (other thread in this group if interested see message
76135, 76138 and 76139 on ruby-talk) it seems to be related to the
shebang i use :
#!/usr/bin/env ruby # [with or without -w]
the args given to a ruby script are miss-interpreted by the SHELL.
So don’t do this any more. Instead, create a symlink located
at /usr/local/bin/ruby. Change this symlink when you want to change Ruby
I’ve discovered that today althought i’m using ruby at least since 3
and i’m more or less obliged to use this kind of shebang because the
No, you are not obliged to do this. You can edit your scripts before
delivery. Or you can make rewrite /usr/bin/env to do something special
you WRT Ruby (a less attractive solution).
i’ve use /usr/bin/ruby for ruby where i use /opt/local/bin/ruby, i
don’t want to change anything – even the shebang – between my version
and the version for the users…
- Change your scripts to all refer to /usr/local/bin/ruby.
- Change your system/user search path to have /usr/local/bin as the
- Put a symlink at /usr/local/bin/ruby, change it as required.
- Don’t use environmental variables.
- Don’t use aliases.
- Use a Ruby script to edit your scripts, before delivery to your
that changes /usr/local/bin/ruby to whatever the client needs to have
Alternative: create your own version of /usr/bin/env that doesn’t mess
the search for Ruby.
If (1) the code you are running is identical to the code you posted, and
(2) you are still getting the error message, then (3) you have to get rid
of two of the three Ruby versions that are now living on your system.
NO definitely NO the first version is the one used by Apple’s OS i don’t
want to touch it.
Okay, then. Use a symlink. And hope that these various Ruby versions are
writing to the same library locations.
then i need at least a second version to play with gems.
the second is mine installed in a proper way by MacPort, this is the one
i’m using generally.
the third is devoted to jRuby and doesn’t interfere by anyway with the
others because first it isn’t in the PATH, second it’s under my HOME,
third it is a somehow “special” ruby for jRuby (ruby 1.8.5 (0) [java])
and lastly the executable files aren’t root:admin as owner:group rather
Your argument seems to be:
“I must have multiple Ruby versions.”
“I can’t get my scripts to work.”
As Americans say, something has to give.
Except that your system will not execute perfectly good code, which means
the three Ruby versions are not cohabiting nicely – unless you are
typing your code instead of copying it.
not all the prob, i’ve discovered that this morning comes from Apple’s
itself since years (2 to 3) and it’s really odd.
The fact is that perfectly good code raised an error message, and you do
know why. The error in /usr/bin/env can’t cause good Ruby code to
an error, because it would have selected a Ruby version, and no Ruby
version would have rejeted the line you posted.
Re-reading … What? You are saying that the Apple Ruby version is the
source of the error? So remove that version of Ruby from your system.
Update it, delete it, whatever.
Don’t you realize that this error-prone Ruby version (if this is what
are saying) may have hundreds of other surprises for you? That this will
make it impossible to develop code that can be expected to work reliably