Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

bash - /bin/sh^M: bad interpreter: No such file or directory

When I enter brew doctor (or any brew command) in my terminal, I get this as a response:

-bash: /usr/local/bin/brew: /bin/sh^M: bad interpreter: No such file or directory

I have seen the ^M response before and I think it has to do with dos line ending files. Is there a way to fix this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This worked for me:

  1. Open file /usr/local/bin/brew with vi (vi /usr/local/bin/brew)
  2. While on vi issue this commad (via esc or :) :set fileformat=unix
  3. Close file on vi via :wq!

The brew command should be OK now.

Regards.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...