should work, so it sounds like your $PATH environment variable doesn’t
contain the rvm bin path. Try running:
source "$HOME/.rvm/scripts/rvm"
That should do the trick for your current shell session, but you can add
it
to your .bashrc/.bash_profile to set up the environment variable each
time
you open your terminal. Hope that helps.
should work, so it sounds like your $PATH environment variable doesn’t
contain the rvm bin path. Try running:
source "$HOME/.rvm/scripts/rvm"
That should do the trick for your current shell session, but you can add
it
to your .bashrc/.bash_profile to set up the environment variable each
time
you open your terminal. Hope that helps.
Thanks, Jon.
Well, here’s what I have in my bash profile. I believe it was put in
there when I installed dvm
if [[ -s $HOME/.rvm/scripts/rvm ]]; then
source $HOME/.rvm/scripts/rvm;
Is that doing exactly the same thing that you had me do above?
I just put “#!/usr/bin/env ruby” into one of my Ruby scripts now. I
tried to run it and it says:
Yeh, your ruby path hasn’t been included in that. You want to be seeing
“/Users/peterbailey/.rvm/rubies/ruby-1.9.3-p362/bin” somewhere in there.
Try sourcing ~/.rvm/environments/default - I’ve found that it’s
sometimes
necessary (when it’s a full moon, for instance):
$ source "$HOME/.rvm/environments/default"
Then check your $PATH again and see whether it’s added your rubies bin
directory.
OK. Did that. And, yes, now I see that Ruby directory in my path, first
thing in fact. But, I’m still getting “env: ruby\r: No such file or
directory” when I try to run a Ruby script, one with the shebang you
told me of earlier.
OK. Did that. And, yes, now I see that Ruby directory in my path, first
thing in fact. But, I’m still getting “env: ruby\r: No such file or
directory” when I try to run a Ruby script, one with the shebang you
told me of earlier.
I think Hassan’s right, that \r looks out of place. That’s a carriage
return character, which shouldn’t be there. Just try running this from
the
command line:
$ /usr/bin/env ruby -v
If you get the ruby version printed out then the problem isn’t your path
or
RVM set up, it’s a character issue in the file that you’re trying to
run.
All decent text editors/IDEs have an option to show special characters.
Try
deleting the entire “#!/usr/bin/env ruby” line and retyping it by hand,
then running again.
OK. Did that. And, yes, now I see that Ruby directory in my path, first
thing in fact. But, I’m still getting “env: ruby\r: No such file or
directory” when I try to run a Ruby script, one with the shebang you
told me of earlier.
I think Hassan’s right, that \r looks out of place. That’s a carriage
return character, which shouldn’t be there. Just try running this from
the
command line:
$ /usr/bin/env ruby -v
If you get the ruby version printed out then the problem isn’t your path
or
RVM set up, it’s a character issue in the file that you’re trying to
run.
All decent text editors/IDEs have an option to show special characters.
Try
deleting the entire “#!/usr/bin/env ruby” line and retyping it by hand,
then running again.
OK. I get:
ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-darwin12.2.0]
I’m using RubyMine as my Ruby editor. I’ve never had a problem with it.
But, I did delete the shebang and re-enter it. Still no luck.
I just put “#!/usr/bin/env ruby” into one of my Ruby scripts now. I
tried to run it and it says:
env: ruby\r: No such file or directory
? Did you copy/paste that from somewhere? That \r looks out of
place.
08:11 ~ $ cat bar
#!/usr/bin/env foo
WAT
08:11 ~ $ ./bar
env: foo: No such file or directory
08:11 ~ $
Yes, I see that “\r” whenever I try to run a Ruby script. I have no idea
where it’s coming from. I thought it might be because the Ruby script
I’m trying to run originally came from a PC. But, my RubyMine software
is a Mac app., so, it should be saving the file as a Mac file, not a
Windows file.
Yes, I see that “\r” whenever I try to run a Ruby script. I have no idea
where it’s coming from. I thought it might be because the Ruby script
I’m trying to run originally came from a PC. But, my RubyMine software
is a Mac app., so, it should be saving the file as a Mac file, not a
Windows file.
We can see whether it’s something in the file if you pass the binary
file
(with the shebang) through xxd, and paste the output:
$ xxd /path/to/your/executable
That will give us the hex codes of the characters in your file, and we
can
see whether there’s something dodgy in there.
I just put “#!/usr/bin/env ruby” into one of my Ruby scripts now. I
tried to run it and it says:
env: ruby\r: No such file or directory
? Did you copy/paste that from somewhere? That \r looks out of
place.
08:11 ~ $ cat bar
#!/usr/bin/env foo
WAT
08:11 ~ $ ./bar
env: foo: No such file or directory
08:11 ~ $
Yes, I see that “\r” whenever I try to run a Ruby script. I have no idea
where it’s coming from. I thought it might be because the Ruby script
I’m trying to run originally came from a PC. But, my RubyMine software
is a Mac app., so, it should be saving the file as a Mac file, not a
Windows file.
I got it! Yes, it was indeed some Windows gibberish. I opened my Ruby
script in BBEdit and saved it as a Unix file. Now, the script works!
Thank you all for your help!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.