mac homebrew国内镜像源安装

ops/2024/11/24 0:15:17/

最近换电脑了,需要安装homebrew,结果发现访问不了github,导致安装失败,报错信息如下:

curl: (7) Failed to connect to raw.githubusercontent.com port 443 after 1 ms: Couldn't connect to server

解决方法

使用国内的镜像源可以安装成功:

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

执行后按照提示确认即可,一路丝滑到底,还顺便帮你设置了国内的下载源。

git version 2.39.3 (Apple Git-146)开始执行Homebrew自动安装程序[cunkai.wang@foxmail.com]['2024-11-19 16:24:22']['14.3']https://zhuanlan.zhihu.com/p/111014448请选择下列一个 数字编号 后回车
(这里只是下载brew,随意选。国内下载源有5种稍后让你选择配置)1、通过清华大学下载brew
2、通过Gitee下载brew
3、!我已经安装brew,跳过克隆,直接带我去配置国内下载源
4、不克隆brew,只把仓库地址设置成Gitee
5、不克隆brew,只把仓库地址设置成清华大学请输入序号: 1你选择了清华大学brew本体下载源Mac os设置开机密码方法:(设置开机密码:在左上角苹果图标->系统偏好设置->用户与群组->更改密码)(如果提示This incident will be reported. 在用户与群组中查看是否管理员)
请输入开机密码,输入过程不显示,输入完后回车
Password:
已获取权限==> 安装过程开始调用Brew官方安装脚本,提示会变成英文,看不懂的复制到在线翻译。如果下载速度慢可以ctrl+c或control+c重新运行脚本选择下载源->  !!!!是否删除之前本机安装的Brew(是Y  否N) 我没有检测本机是否安装brew,选哪个都会继续运行(Y/N):   Y--> 脚本开始执行---备份要删除的/opt/homebrew到系统桌面,后续可把桌面的文件删除....
cp: /opt/homebrew/Library/Homebrew/os/mac/pkgconfig/fuse/osxfuse.pc: No such file or directory
cp: /opt/homebrew/Library/Homebrew/os/mac/pkgconfig/fuse/fuse.pc: No such file or directory---/opt/homebrew 备份完成---备份要删除的/Users/.../Library/Caches/Homebrew到系统桌面,后续可把桌面的文件删除....---/Users/.../Library/Caches/Homebrew 备份完成
未发现Git代理(属于正常状态)开始  进入brew官方安装脚本  开始下载官方install.sh文件,当前目录是: /Users/...
Cloning into 'brew-install-ck'...
remote: Enumerating objects: 19, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 19 (delta 0), reused 12 (delta 0), pack-reused 0
Receiving objects: 100% (19/19), 21.58 KiB | 526.00 KiB/s, done.
==> Checking for `sudo` access (which may request your password)...
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
==> The following new directories will be created:
/opt/homebrew/bin
/opt/homebrew/etc
/opt/homebrew/include
/opt/homebrew/lib
/opt/homebrew/sbin
/opt/homebrew/share
/opt/homebrew/var
/opt/homebrew/opt
/opt/homebrew/share/zsh
/opt/homebrew/share/zsh/site-functions
/opt/homebrew/var/homebrew
/opt/homebrew/var/homebrew/linked
/opt/homebrew/Cellar
/opt/homebrew/Caskroom
/opt/homebrew/FrameworksPress RETURN/ENTER 现在是brew官方安装提示,它需要你按回车键开始 other key to abort:
==> /usr/bin/sudo /usr/bin/install -d -o root -g wheel -m 0755 /opt/homebrew
==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /bin/chmod ug=rwx /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /bin/chmod go-w /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown ... /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/sbin/chown -R ...:admin /opt/homebrew
==> /usr/bin/sudo /bin/mkdir -p /Users/.../Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/.../Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown -R ... /Users/.../Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Enumerating objects: 286049, done.
remote: Counting objects: 100% (86208/86208), done.
remote: Compressing objects: 100% (10307/10307), done.
remote: Total 286049 (delta 84850), reused 75945 (delta 75901), pack-reused 199841
remote: Enumerating objects: 55, done.
remote: Counting objects: 100% (35/35), done.
remote: Total 55 (delta 35), reused 35 (delta 35), pack-reused 20
==> Fetching /opt/homebrew...==> Resetting /opt/homebrew...
Reset branch 'stable'==> Installation successful!==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).==> Homebrew is run entirely by unpaid volunteers. Please consider donating:https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew#donations==> Next steps:
- Run these commands in your terminal to add Homebrew to your PATH:echo >> /Users/.../.zprofileecho 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/.../.zprofileeval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:https://docs.brew.sh此步骤成功
Password:完成  退出brew官方安装脚本  完成==> 配置国内镜像源HOMEBREW BOTTLE
此处如果显示Password表示需要再次输入开机密码,输入完后回车
sed: /Users/.../.zprofile: No such file or directory
有些电脑xcode和git混乱,再运行一次,此处如果有error正常。
xcode-select: note: Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updatesHomebrew已经安装成功,接下来配置国内软件下载源。请选择今后brew install的时候访问那个国内镜像,例如阿里巴巴,输入5回车。1、中科大国内源
2、清华大学国内源
3、上海交通大学国内源
4、腾讯国内源
5、阿里巴巴国内源(推荐)
请输入序号: 5你选择了阿里巴巴国内源环境变量写入->/Users/.../.zprofile此步骤成功==> 安装完成,brew版本Homebrew 4.4.6
Homebrew前期配置成功
==> Updating Homebrew...
==> Downloading https://mirrors.aliyun.com/homebrew/homebrew-bottles/bottles-portable-ruby/portable-ruby-3.3.6.arm64_big_sur.bottle.tar.gz
############################################################################################################### 100.0%
==> Pouring portable-ruby-3.3.6.arm64_big_sur.bottle.tar.gz
==> Homebrew collects anonymous analytics.
Read the analytics documentation (and how to opt-out) here:https://docs.brew.sh/Analytics
No analytics have been recorded yet (nor will be during this `brew` run).==> Homebrew is run entirely by unpaid volunteers. Please consider donating:https://github.com/Homebrew/brew#donationsAlready up-to-date.Homebrew自动安装程序运行完成国内地址已经配置完成之前步骤选了删除本机brew的话,桌面多出一个Old_Homebrew文件夹,可以删除。初步介绍几个brew命令
查看版本:brew -v  更新brew版本:brew update
查找:brew search python(其中python替换为要查找的关键字)
安装:brew install python(其中python替换为要安装的名称)
本地软件库列表:brew ls欢迎右键点击下方地址-打开链接 点个赞吧https://zhuanlan.zhihu.com/p/111014448如果遇到问题可以右键下面地址查看常见错误解决办法https://gitee.com/cunkai/HomebrewCN/blob/master/error.mdbrew官方地址:https://brew.sh/zh-cn/安装成功 但还需要重启终端 或者 运行 source /Users/.../.zprofile   否则国内地址无法生效

参考文献

Homebrew 国内自动安装指南(Mac & Linux适用)
brew sh


http://www.ppmy.cn/ops/136177.html

相关文章

【软件测试】设计测试用例的万能公式

文章目录 概念设计测试用例的万能公式常规思考逆向思维发散性思维万能公式水杯测试弱网测试如何进行弱网测试 安装卸载测试 概念 什么是测试用例? 测试⽤例(Test Case)是为了实施测试⽽向被测试的系统提供的⼀组集合,这组集合包…

Qt 开发笔记

上层控件遮挡底部控件 setAttribute(Qt::WA_TranslucentBackground); // 设置控件透明设置控件透明 存在一些事件会被过滤 setAttribute(Qt::WA_NoSystemBackground); // 使事件生效WA_OpaquePaintEvent //未验证树结构 子节点设置缩进宽度 treewidget 设置子节点缩进 setInde…

Semaphore 信号量

文章目录 基本概念工作原理Semaphore 与 ReentrantLockSemaphore常用场景1. 限制并发线程数(最常见场景)2. 公平模式的信号量(保证按顺序访问资源)3. 限制数据库连接数(模拟数据库连接池)4. 限制 API 请求次…

使用uniapp开发微信小程序使用uni_modules导致主包文件过大,无法发布的解决方法

在使用uniapp开发微信小程序时候,过多的引入uni_modules的组件库,会导致主包文件过大,导致无法上传微信小程序,主包要求大小不超过1.5MB.分包大小每个不能超过2M。 解决方法:分包。 1.对每个除了主页面navbar的页面进…

医药企业的终端市场营销策略

近年来,随着医药行业的快速发展,终端市场逐渐成为企业竞争的关键领域。在政策趋严、市场环境变化以及数字化转型的大背景下,医药企业如何在终端市场中立于不败之地?本文结合我们在医药数字化领域的经验,为大家剖析终端…

CPU详细介绍

CPU(中央处理器,Central Processing Unit)是计算机系统的核心部件之一,被称为计算机的“大脑”。它负责执行计算机程序中的各种指令,并管理和协调计算机系统的各个硬件组件。以下是对 CPU 的详细介绍,包括其…

前端图像处理(一)

目录 一、上传 1.1、图片转base64 二、图片样式 2.1、图片边框【border-image】 三、Canvas 3.1、把canvas图片上传到服务器 3.2、在canvas中绘制和拖动矩形 3.3、图片(同色区域)点击变色 一、上传 1.1、图片转base64 传统上传: 客户端选择图片&#xf…

Spark RDD Checkpoint 常用于需要高容错性或深度依赖链优化的场景,特别是在机器学习和大数据处理过程中。

Spark RDD Checkpoint 常用于需要高容错性或深度依赖链优化的场景,特别是在机器学习和大数据处理过程中。下面详细分析其适用场景、原因和典型应用示例。 1. 常用场景 1.1 复杂计算链优化 场景: RDD 的依赖链非常复杂(深度很长&#xff09…