新手问题 Homebrew 在 Mac OSX 10.9 下无法安装

michalyang · 2014年01月04日 · 最后由 ruohanc 回复于 2014年01月05日 · 6681 次阅读

捣鼓了一下午 Homebrew 总是出错,stackoverflow 上也没有大神给指点下,希望这里能遇到大神指点下。

我按照官网的安装方法,把 “ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"” 拷贝到 terminal 执行后,

==> 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/.
/usr/local/bin
/usr/local/lib
/usr/local/share
/usr/local/share/man
/usr/local/share/man/man1
/usr/local/share/man/man3
/usr/local/share/man/man5
/usr/local/share/man/man7
==> The following directories will have their group set to admin:
/usr/local/.
/usr/local/bin
/usr/local/lib
/usr/local/share
/usr/local/share/man
/usr/local/share/man/man1
/usr/local/share/man/man3
/usr/local/share/man/man5
/usr/local/share/man/man7

Press ENTER to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/lib /usr/local/share /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7
Failed during: /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/lib /usr/local/share /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7
bogon:~ young$ 

这里说

Failed during: /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/lib /usr/local/share /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7

请问我该怎么操作? (我嫌 Xcode 太大了,没有装,但是装了 Xcode Command Line Tools)

权限的问题么貌似。。。xcode 还好,为何不直接装,也就 5 个 g 不到。。

#1 楼 @Ryan 我开启了 root 账号,然后重启电脑,以 root 的方式登录,再输入命令行安装, Last login: Sat Jan 4 21:24:43 on console bogon:~ root# ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" Don't run this as root! bogon:~ root#

#2 楼 @andor_chen 是这样吗?

Last login: Sat Jan 4 21:31:11 on ttys000 bogon:~ young$ sudo ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" -bash: sudo: command not found bogon:~ young$

#2 楼 @andor_chen github 上有人说,让我试试手动安装

/usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/lib /usr/local/share /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7

这一段,但是我不太懂,是在 terminal 里输入

run /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/lib /usr/local/share /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7

这样吗?

#5 楼 @michalyang 首先不要用 sodu 安装 homebrew。安装是不需要用管理员身份安装。但是在安装过程中,安装程序需要用 sudo 去修改一些路径,文件的权限,安装过程中启用 sudo 的时候会问你的管理员密码,你输入正确了么?

#6 楼 @lgn21st 我也纳闷:我安装的时候就是正常安装的,没有用管理员权限,正如我帖子里发的,执行到了 “Press ENTER to continue or any other key to abort ”,我按 Enter 就出现了 ==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/lib /usr/local/share /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7 Failed during: /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/lib /usr/local/share /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7 bogon:~ young$

根本没有问管理员密码

#7 楼 @michalyang 这里应该是执行 sudo 失败,但是失败总有原因吧?那么你手动执行这个命令的结果又是什么呢?有没有告诉你为什么失败?

这些目录都存在吗? 怀疑是没装 xcode 所以不存在.

/usr/local/bin /usr/local/lib /usr/local/share /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7

少的目录都补上应该就好了

#8 楼 @lgn21st 我进到/usr/bin/下面 手动执行了下,

bogon:~ young$ sudo /bin/chmod g+rwx /usr/local/.

返回 -bash: sudo: command not found

这意味着我的 sudo 文件丢失吗?

#9 楼 @luikore 文件都在哈,可以 cd 到

#10 楼 @michalyang 说明 /usr/bin 不在路径内, /usr/bin/sudo 应该有的 (bash 不是 cmd, 你要 ./sudo), 没有就重装系统吧...

谢谢 rubychina 的大神,尽管是个噩耗....

#13 楼 @michalyang 或者找个人拷一下...

#10 楼 @michalyang echo $PATH 不如先装个 xcode……

嗯,已经重装系统了。谢谢:)

重装系统了。。。小哥的执行力好强。。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号