Ryan Bobrowski
Ryan Bobrowski

Reputation: 2730

Ruby on Rails - bin files shebang causing issues (Mac)

So for the files in the /bin directory of a normal rails installation (bin/rails, bin/rake, bin/bundle), the shebang at the top of the file is:

#!/usr/bin/env ruby.exe

But when I run bin/rails, for example, I get the error:

env: ruby.exe: No such file or directory

When I remove the .exe from the end of the shebang, everything works fine. But I was just curious:

  1. Why is this necessary
  2. How to deal with versioning, since the other developer working on this doesn't need to remove the .exe. It's suggested to keep the bin folder in the repo, so I'd prefer to just get the .exe version working if anything.

Upvotes: 1

Views: 291

Answers (1)

Tilo
Tilo

Reputation: 33732

There are no .exe files on Mac OS X or on Linux. On those platforms the Ruby executable is just called ruby.

For compatibility to those operating systems, your first line should look like this:

  #!/usr/bin/env ruby

Upvotes: 2

Related Questions