今天在 Mac 装 Homebrew 遇到了一个问题,在网上找了大量解决方案,做个总结。

Mac 版本 High Sierra 10.13.6。

问题描述

在 Mac 终端输入了 Homebrew 官网给的安装指令:

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

结果安装到最后出现了错误:

fatal: unable to access 'https://github.com/Homebrew/brew/': Could not resolve host: github.com
Failed during: git fetch origin master:refs/remotes/origin/master --tags --force

网上都说是网不通,可是我也挂着 ss,应该不是这个问题,很多解决方法是修改成镜像的链接,不过貌似都不见效。试着在终端 ping 了一下 GitHub 的地址:

ping github.com

结果出现了下面这个结果,还真是网不通。

ING github.com (13.250.177.223): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3

解决方案

修改 host 配置,在终端中输入下列指令,打开编辑文件。

sudo vi /etc/hosts

s键 进入编辑模式,在最下面添加 192.30.253.113 github.com

control + c键 保存,接着输入:wq退出即可。

再次尝试在终端 ping github.com,发现已经成功了。

接着继续在终端输入官网的安装指令,就能安装成功了。

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

常见问题

如果在安装过程中出现以下情况,就是网不通,再次输入官网安装指令即可。

error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: The remote end hung up unexpectedly

【Mac】安装 Homebrew 出错 Failed during: git fetch origin master:refs/remotes/origin/master --tags --force的更多相关文章

  1. homebrew安装问题(Failed during: git fetch origin master:refs/remotes/origin/master --tags --force)

    在mac系统中,使用homebrew可以很方便的管理包.按照官网的说明执行以下命令时总是报错: /usr/bin/ruby -e "$(curl -fsSL https://raw.gith ...

  2. Mac 安装HomeBrew 出错

    错误如下: error: could not lock config file /usr/local/Homebrew/.git/config: Permission denied fatal: co ...

  3. homebrew update 出现Failure while executing: git pull --quiet origin refs/heads/master:refs/remotes/origin/master解决方案

    具体可以参考https://github.com/Homebrew/homebrew/issues/21002 cd /usr/local git status git reset --hard or ...

  4. 解决mac安装homebrew后报错-bash: brew: command not found

    解决mac安装homebrew后报错-bash: brew: command not found     参照官网上很简单的一句安装命令, /usr/bin/ruby -e "$(curl ...

  5. Mac安装Homebrew的那些事儿

    Mac安装Homebrew的那些事儿 最近小明刚换置了一个 Mac 本,想搭建一个属于自己的博客网站,需要用到 Node.js 环境,而Node.js 在 MacOS 中是由 Homebrew 进行安 ...

  6. 项目记事【Git】:git pull 出错 error: cannot lock ref 'refs/remotes/origin/feature/hy78861': is at d4244546c8cc3827491cc82878a23c708fd0401d but expected a6a00bf2e92620d0e06790122bab5aeee01079bf

    今天 pull 代码的时候碰到以下问题(隐去了一些公司敏感信息): XXX@CN-00012645 MINGW64 /c/Gerrard/Workspace/XXX (master) $ git pu ...

  7. git问题 next fetch will store in remotes/origin

    项目在git的下无法查找到需要的Branch

  8. Git Push:error: Couldn't set refs/remotes/origin/master;error: update_ref failed for ref 'refs/remot

    作者:荒原之梦 原文链接:http://zhaokaifeng.com/?p=543 今天使用Git Push代码时产生错误: Rename from 'XXXX/.git/refs/remotes/ ...

  9. Mac安装homebrew,postman,charles

    Homebrew是一款Mac OS平台下的软件包管理工具,拥有安装.卸载.更新.查看.搜索等很多实用的功能.简单的一条指令,就可以实现包管理,而不用你关心各种依赖和文件路径的情况,十分方便快捷. 1. ...

随机推荐

  1. vs安装部署“必备”组件里面正常情况没有出现office2010 PIA组件

    vs安装部署“必备”组件里面正常情况没有出现office2010 pia组件时,将 Office2010PIARedist 文件夹放在C:\Program Files\Microsoft SDKs\W ...

  2. August 25th 2017 Week 34th Friday

    Stop to have a rest, do not forget others still in the running. 停下来休息的时候,不要忘记别人还在奔跑. You don't need ...

  3. August 08th 2017 Week 32nd Tuesday

    The very essence of romance is uncertainty. 浪漫的精髓就在于它充满种种可能. Romance is the glamour that can turn th ...

  4. ECharts.js学习(三)交互组件

    ECharts.js 交互组件 ECharts.js有很多的交互组件,一般经常用到的组件有这些: title:标题组件,包含主标题和副标题. legend:图例组件,展现了不同系列的标记(symbol ...

  5. Maven编译Java程序配置

    Hive 需要在工程里添加的Jar包: hadoop-2.2.0/share/hadoop/common/hadoop-common-2.2.0.jar $HIVE_HOME/lib/hive-exe ...

  6. CyclicBarrier和CountDownLatch笔记

    一.CyclicBarrier的使用 Barrier是栅栏,障碍物的意思,这里将它理解为栅栏. Cyclic是重复利用的意思. CyclicBarrier:可重复利用的栅栏.这里附上官方文档的一句解释 ...

  7. Linux调整系统时间

    1.yum search ntp(搜索可安装的ntpn) 2.yum install ntp.x86_64 3.service ntpd start 4.ps -ef | grep ntpd 5.da ...

  8. Python version 3.6 required, which was not found in the registry错误解决

    问题: 安装pywin32出现Python version 3.6 required, which was not found in the registry错误解决 解决: 建立一个文件 regis ...

  9. Guava包学习--Table

    Table,顾名思义,就好像HTML中的Table元素一样,其实就是行+列去确定的值,更准确的比喻其实就是一个二维矩阵. 其实它就是通过行+列两个key去找到一个value,然后它又containsv ...

  10. VirtualBox操作总结

    1. VirtualBox安装 下载rpm,rpm -ivh 安装 2. 在图形界面打开virtual box virtualbox 3. vboxmanage打开虚拟机 vboxmanage sta ...