最新homebrew安装方法(四小时踩坑成果)

最新homebrew安装方法(四小时踩坑成果)

在查找过程中发现,好多博客里的安装命令都是

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

结果点开https://raw.githubusercontent.com/Homebrew/install/master/install 发现内容为:

Warning: The Ruby Homebrew installer is now deprecated and has been rewritten in
Bash. Please migrate to the following command:
/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)”

网址变为了https://raw.githubusercontent.com/Homebrew/install/master/install.sh

下载install.sh

https://raw.githubusercontent.com/Homebrew/install/master/install.sh中的内容复制到本地目录作为shell脚本。

执行install.sh

1.如果卡在

Downloading Command Line Tools for Xcode……

不用安装Xcode,用xcode-select --install命令安装Command Line Tools
继续执行install.sh

2.如果下载速度很慢只有几kb,更换shell脚本中的资源链接为国内的镜像。

找到如下代码

BREW_REPO = “https://github.com/Homebrew/brew”
更换为
BREW_REPO = “https://mirrors.ustc.edu.cn/brew.git”

就OK了,别的博客中有更换CORE_TAP_REPO,但由于最新版本的shell脚本中没有,就不进行更换。
重新执行./install.sh

3.之后又卡在了

==> Tapping homebrew/core
Cloning into ‘/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core’…

执行如下命令:
cd "$(brew --repo)/Library/Taps/"
mkdir homebrew && cd homebrew
git clone git://mirrors.ustc.edu.cn/homebrew-core.git
再重新执行脚本./install.sh

看到

==> Installation successful!

就是安装成功了!

通过brew -v查看一下是否成功
记得加入环境变量

参考:
mac下国内安装Homebrew教程
Mac OS 安装Homebrew,亲测有效,网上其他的都不靠谱

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值