Mac homebrew 安装

本文详细介绍了在Mac上安装Homebrew时遇到的问题及解决方案,包括如何通过配置国内源解决连接timeout问题,以及如何切换和恢复Homebrew的默认源。此外,还提供了检查安装成功的方法和配置国内镜像的步骤,确保后续包管理的快速下载。
摘要由CSDN通过智能技术生成

Mac homebrew 安装:

安装大都会卡在

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation timed out 或者 connection refuesd

原因就是没有配置 terminal 代理

可以通过国内的源来解决:

/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"
或者
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

笔者配置了 terminal 代理:使用的国外的源:

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

安装完成后,检测是否安装成功。

brew -v 

配置国内的brew 镜像:

如果你配置了 terminal 代理,那么不配置国内源也无所谓,下载速度倒是会快。

git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git

git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

brew update

brew config 查看:笔者这里的 cask 配置时报No such file or directory, 不知道怎么回事

在这里插入图片描述

恢复至默认源:

git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git

git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git

git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git

brew update

至此 Mac homebrew 就配置安装完成啦!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值