Facing issues while using binstubs

Recently, I’ve been getting errors while using binstubs on MacOS. My workflow is completely dependent on them.

env: ruby\r: No such file or directory

Looks like there’s some problem with line endings?

My temporary workaround is to use ruby bin/unicorn etc. While doing that, I get this warning ruby: warning: shebang line ending with \r may cause problems

Any pointers whould be super helpful. Any ideas @david

Sounds like you have somehow ended up with windows-style line endings in the binstubs. Maybe you opened the files in Windows? Or switched your text editor to use windows-style line breaks?

What do you see if you run file bin/unicorn. I see this:

❯ file bin/unicorn
bin/unicorn: Ruby script text executable, ASCII text

If I manually change the line endings to Windows, I see the same error as you, and file shows me:

❯ file bin/unicorn
bin/unicorn: Ruby script text, ASCII text, with CRLF line terminators

^^ When things are in this broken state, it shows as a diff in Git, and running git reset --hard fixes things up.

5 Likes