无法安装brew

时间:2017-05-24 20:24:57

标签: ruby macos terminal homebrew macos-sierra

我在终端运行了这个:

brew install libsndfile

出现了这个错误:

/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0

所以在终端,I ran steps 1-5 as suggested in this answer

1. open terminal  
2. $ cd /usr/local/Library/Homebrew  
3. $ git reset --hard  
4. $ git clean -df
5. $ brew update

这是输出的屏幕截图:

enter image description here

如何让命令brew install libsndfile起作用?

1 个答案:

答案 0 :(得分:1)

GitHub issue中提到同样的事情。您的问题的原因是您安装了一个非常旧版本的Homebrew仍然依赖于Ruby 1.8,它已被macOS 10.10中的Ruby 2.0取代。

如果您检查问题,您会发现两个略有不同的解决方案。为打开原始问题的人工作的那个是在终端中运行这些命令:

cd /usr/local/Homebrew
git fetch origin
git reset --hard origin/master

之后,您可以运行brew upgrade来更新已安装的软件包(可能需要一些时间)。

相关问题