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

前端 未结 2 1576
南笙
南笙 2020-12-08 16:15

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

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 17:15

    I don't know how carriage returns ended up in your brew file, but you can remove them using dos2unix or by piping it through tr -d '\r'.

    Example:

    tr -d '\r'  < /usr/local/bin/brew   > myfixedbrew
    

    Once verified, you can use

    mv myfixedbrew /usr/local/bin/brew && chmod a+x /usr/local/bin/brew 
    

    to replace the old one.

提交回复
热议问题