git 复制文件时 Homebrew 安装失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40592463/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Homebrew install fails while copying files
提问by Mindaugas
I run this:
我运行这个:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
I get prompt:
我得到提示:
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
After I click "return"(enter button) I get this error:
单击“返回”(输入按钮)后,出现此错误:
==> Downloading and installing Homebrew...
fatal: cannot copy '/usr/local/git/share/git-core/templates/hooks/pre-receive.sample' to '/usr/local/Homebrew/.git/hooks/pre-receive.sample': Permission denied
Failed during: git init -q
Any ideas what kind of error I am facing and what can be done? It is not really clear for me as it is first time I am facing something like this.
任何想法我面临什么样的错误以及可以做什么?这对我来说不是很清楚,因为这是我第一次面对这样的事情。
回答by Harald Nordgren
You are getting permission denied when downloading the files into /usr/local
.
将文件下载到/usr/local
.
This folder often belongs to root. This is a known issue with brew. Fix it by doing
此文件夹通常属于根目录。这是 brew 的一个已知问题。通过做来修复它
sudo chown -R $(whoami) $(brew --prefix)/*
and then re-run the installer.
然后重新运行安装程序。
回答by Vini App
I could get it working with
我可以让它工作
sudo chown -R $USER /usr/local
thanks to @joran for suggesting this in comments
感谢@joran 在评论中提出这个建议
回答by anoop francis
If nothing works, then just uninstall and install home-brew again.
如果没有任何效果,那么只需卸载并再次安装 home-brew。
Uninstall command:
卸载命令:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Install command:
安装命令:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
回答by gurlinthewurld
I ran into the error message issue trying to update Brew via another Mac user. When I tried entering the above sudo chown -R $USER /usr/local
I got:
我在尝试通过另一个 Mac 用户更新 Brew 时遇到了错误消息问题。当我尝试输入上述内容时,sudo chown -R $USER /usr/local
我得到:
chown: /usr/local: Operation not permitted
I found thissudo chown -R $(whoami) $(brew --prefix)/*
which allowed me to perform install of brew for separate Mac user.
我发现这sudo chown -R $(whoami) $(brew --prefix)/*
允许我为单独的 Mac 用户安装 brew。