Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am using ubunutu natty narwhal.I had installed ruby,rails,rvm etc.. sometime back and everything was running peacefully.Recently i tried to execute "rails -v" on the command line i get this frustrating error.

    roger@roger-Inspiron-1545:~$ rails -v
    bash: /home/roger/.rvm/gems/ruby-1.9.2-p180/bin/rails: /home/roger/.rvm/rubies/ruby-  1.9.2-p180/bin/ruby:
    bad interpreter: Permission denied

I also get this error for other rails commands i execute Can someone let me know what the problem is and how i can fix this.

Update:Whereis ruby gives me the this

roger@roger-Inspiron-1545:~$ whereis ruby 
ruby: /usr/bin/ruby /usr/bin/ruby1.8 /usr/lib/ruby /usr/share/man/man1/ruby.1.gz

Thanks

share|improve this question
    
What are the permissions on those files, and what should they be? –  tripleee Sep 14 '11 at 15:44
1  
Can you which ruby or whereis ruby to make sure it's pointing to the right spot? –  Kristian PD Sep 14 '11 at 15:59
    
roger@roger-Inspiron-1545:~$ whereis ruby ruby: /usr/bin/ruby /usr/bin/ruby1.8 /usr/lib/ruby /usr/share/man/man1/ruby.1.gz.What should i do? –  rogerstone Sep 14 '11 at 18:05

1 Answer 1

up vote 1 down vote accepted

run:

ls -l /home/roger/.rvm/rubies/ruby-1.9.2-p180/bin/ruby

The first few characters of the entry should be "-rwx" and you should see your own username as the owner. If you don't see at least the "r" and the "x", run

chmod 755 /home/roger/.rvm/rubies/ruby-1.9.2-p180/bin/ruby

to give the owner read/write/exec and everyone else read/execute.

If you aren't the owner, you'll need to do "sudo chown" to fix that.

I suspect that there's a bigger underlying problem though. If you have other ruby versions installed, switch to them in rvm, type "which ruby" and run "ls -l" on them as well.

Did you do a restore from backup recently? Maybe the permissions weren't correctly restored. Or did you run some kind of script that might've been too aggressive in changing owner or permissions? Or maybe you accidentally did a chmod or chown?

share|improve this answer
    
Thanks a lot.It worked.Still don't know how the permissions changed.Thanks again –  rogerstone Sep 15 '11 at 10:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.