Weird rails error "permission denied: bin/rails" for old rails apps

So what worked for me, anyone coming across this issue is to run

bundle exec rake app:update:bin

You'll be given a prompt asking if you want to overwrite? The options here are:

  • Y - yes (default one, just press Enter for it)
  • n - no (leave current file without changes)
  • a - all (apply all changes)
  • q - quit
  • d - diff
  • h - help

I chose a and it seemed to work ok.


I have this when I try to use a rails 4.0 version. So when I try to put bundle exec first, like:

bundle exec rake db:migrate

or

bundle exec rails s

work's.


Run

bundle exec rake rails:update:bin

It will update bin/rails and bin/rake files.


In the directory you mentioned is your rails in executable mode. If not you can apply

chmod u+x bin/rails

and make it executable.