安装homebrew时出现“Undefined method '<'”错误

9

我想在我的Macbook Pro上安装homebrew,以便能够运行NINJA-IDE,但每次执行网站上给出的代码时,都会出现以下错误:

Joshs-MacBook-Pro:~ joshua$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
==> The following directories will be made group writable:
/usr/local/share
==> The following directories will have their group set to admin:
/usr/local/share

Press ENTER to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/share
Password:
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/share
==> Downloading and Installing Homebrew...


Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.


-e:84:in `git': undefined method `<' for nil:NilClass (NoMethodError)
    from -e:153:in `block in <main>'
    from -e:152:in `chdir'
    from -e:152:in `<main>'
Joshs-MacBook-Pro:~ joshua$

我已经彻底研究了“通过sudo以root身份重新运行”的一行,但没有找到答案,因此我认为问题出在我不停看到的NoMethodError上。如果能帮忙解决这个问题,将不胜感激!

2个回答

24

如果您尚未安装,请通过App Store安装XCode。然后运行它,并通过GUI接受许可证。现在再次运行Homebrew安装脚本。这样对我来说解决了问题。


3

刚刚安装了最新版本的XCode并从未打开过。结果发现在运行Homebrew脚本之前必须同意许可协议。只需单独运行XCode并同意许可协议即可解决问题。


这也可以在终端中通过运行以下命令行来完成: sudo xcrun cc - Etienne
@Etienne 很好!谢谢! - Nariman

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接