0

Whenever I try to run a Ruby script as any user but myself, I get this error:

/usr/bin/env: ruby: No such file or directory

I don't understand why this should be the case. When I installed Ruby, why would it think I only want it for one user?

Here's this if it helps:

$ which ruby
/home/jason/.rvm/rubies/ruby-1.9.2-p136/bin/ruby
Jason Swett
  • 43,526
  • 67
  • 220
  • 351
  • Maybe helpful: [RVM cannot use ruby with sudo](http://stackoverflow.com/questions/3644897/rvm-cannot-use-ruby-with-sudo) – miku Jan 27 '11 at 20:58

3 Answers3

3

RVM defaults to only install for your own user account. However, it looks like they provide instructions for a system-wide installation which will allow access to all users. (However, each user will still need the RVM-specific updates in their shell profiles).

http://rvm.beginrescueend.com/deployment/system-wide/

Dylan Markow
  • 123,080
  • 26
  • 284
  • 201
0

Maybe someone else will have a better answer but here's something I came up with:

The first line of my script was this:

#!/usr/bin/env ruby

I changed it to this and now other users can run the script:

#!/usr/bin/env /home/jason/.rvm/rubies/ruby-1.9.2-p136/bin/ruby
Jason Swett
  • 43,526
  • 67
  • 220
  • 351
  • 1
    you have installed ruby inside your home directory, that's why no one can find it. – Mauricio Jan 27 '11 at 21:01
  • Only users who have the same group permissions as you can run it. They could also change it. The "more correct" way to do what you want is to use a [system-wide installation](http://rvm.beginrescueend.com/deployment/system-wide/). RVM is designed as a personal Ruby sandbox, allowing each user to have entirely separate configurations, but your use is not the norm. RVM can handle it elegantly, using the system-wide installation though. – the Tin Man Jan 27 '11 at 22:48
0

I think the other users could be missing /home/jason/.rvm/rubies/ruby-1.9.2-p136/bin in their PATH environment variable, so /usr/bin/env can't find ruby. Check their PATH and see if that is the case.

Morton Fox
  • 186
  • 4
  • The users could add that to their path, but odds are really good the OS would shut down their attempts to execute Ruby. The OP's entire Ruby environment would have to be `chmod`'d to give them access and allow execution, something that isn't recommend for security reasons. – the Tin Man Jan 27 '11 at 22:44