情景再现
在Mac OS X Yosemite 10.10.1中的终端中,执行Homebrew的命令都会出现如下图所示的错误:

具体错误信息:
/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 26: /usr/local/Library/brew.rb: Undefined error: 0
错误分析
由于升级了新版本的Mac OS X系统Yosemite,自带的ruby版本也升级成了2.0.0。但是Homebrew使用的ruby版本是1.8。
解决办法
修改brew.rb的第一行1.8为2.0即可。具体操作如下:
使用vim打开brew.rb文件
vim /usr/local/Library/brew.rb
如下图,将1.8改成2.0
原来的是1.8

修改成2.0

回到终端中输入brew -v 看一下是不是ok了呢

相关阅读
- macOS升级10.15 Catalina出现missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun 的解决办法
- C# NPOI 打开Excel报The process cannot access the file because it is being used by another process的解决办法
- The project file cannot be opened by the project system, because it is missing some critical imports or the referenced SDK cannot be found 的解决办法

全部评论:1条