Reputation: 7671
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
Upvotes: 0
Views: 4375
Reputation: 20857
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?
Upvotes: 2