简体   繁体   English

Mac - 无法安装 Homebrew

[英]Mac - Can’t install Homebrew

I tried to install Homebrew like this:我尝试像这样安装 Homebrew:

ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"

It didn't install correctly so I closed Terminal and tried again.它没有正确安装,所以我关闭了终端并再次尝试。 Now it displays me the following message:现在它向我显示以下消息:

It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup

I tried to do that but without success.我试图这样做,但没有成功。 The following message is displayed:显示以下消息:

brew: command not found

So, the problem is that Homebrew is installed but actually it is not installed.所以,问题是 Homebrew 已安装,但实际上并未安装。 Any suggestions how to solve this problem?任何建议如何解决这个问题? Thank you!谢谢!

This seems to have resolved the issue for me这似乎为我解决了这个问题

rm -rf /usr/local/Cellar /usr/local/.git
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Afterward, I can now之后,我现在可以

brew doctor

You may also find the gist linked to at the following page of use:您还可以在以下使用页面找到链接到的要点:

https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md

The URL contained in the command you are using is not correct.您使用的命令中包含的 URL 不正确。 Ruby will dump out lines of HTML and then fail. Ruby 将转储出 HTML 行然后失败。 Use this command instead:请改用此命令:

ruby -e "$(curl -fsSkL raw.github.com/Homebrew/homebrew/go/install)"

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

这是为我工作!

这对我有用:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

我删除了文件夹/usr/local/.git和 homebrew 之后安装得很好。

What was the message given when it didn't install correctly the first time?第一次安装不正确时给出的消息是什么? Is the brew binary present in /usr/local/bin ? /usr/local/bin 中是否存在 brew 二进制文件? If so, you probably just need to add it to your path, see: Error Installing Homebrew - Brew Command Not Found如果是这样,您可能只需要将其添加到您的路径中,请参阅: 安装 Homebrew 时出错 - 未找到 Brew 命令

Attempting to resolve the same issue, I found out that I had mistyped while making changes to my PATH .在尝试解决相同的问题时,我发现我在更改PATH时输入错误。 I did not have /usr/local/bin .我没有/usr/local/bin I would then recommend running然后我会建议跑步

$ echo $PATH $回声 $PATH

in terminal to see if you have the correct directories.You can also run在终端中查看您是否有正确的目录。您也可以运行

$ vi ~/.bash_profile $ vi ~/.bash_profile

to see it and make changes if neccessary查看它并在必要时进行更改

If you cannot install by using curl try to open the install script from your browser, save it in a file called ie brew_install.rb somewhere on your disk and run the script locally如果您无法使用 curl 安装,请尝试从浏览器打开安装脚本,将其保存在磁盘上某个名为 ie brew_install.rb 的文件中并在本地运行该脚本

ruby brew_install.rb 

This worked for me.这对我有用。

Follow these steps 
1 ==> ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

2 ==> sudo rm -rf /usr/local/Homebrew/
      sudo rm -rf /usr/bin/Homebrew/

3 ==> install brew
      1 -- /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

      2 -- sudo chown -R $(whoami) /usr/local/var/homebrew

If get these error try below command
  Error: Failed to link all completions, docs and manpages:
        sudo chown -R $(whoami) /usr/local/*

  then follow these commands
        /usr/local/bin/brew update --force

This is the most recent one that works for me.这是最近对我有用的一个。

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

I found it here in case it is updated later.我在这里找到它以防以后更新。 https://brew.sh/ https://brew.sh/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM