当前位置: 首页 > news >正文

【MacBook系统homebrew镜像记录】

安装

使用Homebrew 国内源安装脚本,贼方便:

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

在这里插入图片描述

切换至清华大学镜像源:

命令合并: 分别切换了 brew.githomebrew-core.githomebrew-bottles的git地址:

git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

命令分开:

  1. 切换 brew.git

    git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
    
  2. 切换 homebrew-core.git

    git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
    
  3. 切换 homebrew-bottles
    使用的是 zsh 而非 bash shell

    echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
    source ~/.zshrc
    

    使用的是 bash shell 而非 zsh时:

    echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
    source ~/.bash_profile
    
  4. 切换 homebrew-bottles/api
    使用 bash shell

    echo 'export HOMEBREW_API_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api' >> ~/.bash_profile
    source ~/.bash_profile
    

切换至中科大镜像源:

命令合并: 分别切换了 brew.githomebrew-core.githomebrew-bottles的git地址:

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
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

命令分开:

  1. 切换 brew.git

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

    git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
    
  3. 切换 homebrew-bottles
    使用的是 zsh 而非 bash shell

    echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
    source ~/.zshrc
    

    使用的是 bash shell 而非 zsh时:

    echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
    source ~/.bash_profile
    
  4. 切换 homebrew-bottles/api
    使用 bash shell

    echo 'export HOMEBREW_API_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/api' >> ~/.bash_profile
    source ~/.bash_profile
    

完成以上操作后,你的Homebrew就会开始使用选定的镜像源。注意,如果你使用的是 bash shell 而非 zsh,你需要将上述命令中的 .zshrc 替换为 .bash_profile.bashrc

你可以在终端中运行以下命令来查看你的默认登录 Shell:

echo $SHELL

如果输出是 /bin/bash,那么你使用的是 Bash。如果输出是 /bin/zsh 或类似路径,那么你使用的是 Zsh。

最后,建议在切换镜像源后运行一次brew update以确保一切正常。


切换回Homebrew源:

  1. 切换 brew.git

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

    git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core
    
http://www.lryc.cn/news/336445.html

相关文章:

  • 深拷贝总结
  • RabbitMQ在云原生环境中部署和应用实践
  • flask 后端 + 微信小程序和网页两种前端:调用硬件(相机和录音)和上传至服务器
  • 蓝桥杯嵌入式(G431)备赛笔记——ADC+LCD
  • 最近公共祖先(LCA)
  • ABBYY FineReader15免费电脑OCR图片文字识别软件
  • 2024年第十七届 认证杯 网络挑战赛 (A题)| 保暖纤维的保暖能力 |数学建模完整代码+建模过程全解全析
  • 算法训练营第37天|LeetCode 738.单调递增的数字 968.监控二叉树
  • Vue+el-table 修改表格 单元格横线边框颜色及表格空数据时边框颜色
  • 大恒相机-程序异常退出后显示被占用
  • 头歌-机器学习 第16次实验 EM算法
  • 电脑启动引导的两种方式
  • 用php编写网站源码的一些经验
  • 海山数据库(He3DB)原理剖析:浅析OLAP数据库计算引擎中的统计信息
  • 视频图像的两种表示方式YUV与RGB(4)
  • PostgreSQL入门到实战-第十四弹
  • 分布式数据库中间件 Mycat 和 ShardingSphere 对比
  • Python实现BOA蝴蝶优化算法优化BP神经网络回归模型(BP神经网络回归算法)项目实战
  • 3D Web轻量化引擎HOOPS Commuicator如何从整体装配中创建破碎的装配零件和XML?
  • 关于运行阿里云直播Demo pub get 报的错
  • C语言调用Python
  • SVN客户端异常问题处理
  • gin+sse实现离散的消息通知
  • C++ //练习 11.38 用unordered_map重写单词计数程序(参见11.1节,第375页)和单词转换程序(参见11.3.6节,第391页)。
  • 【示例】MySQL-4类SQL语言-DDL-DML-DQL-DCL
  • 基于SpringBoot+Vue的果蔬种植销售一体化服务平台(源码+文档+部署+讲解)
  • 数据结构面试
  • Linux 上安装 SQLite
  • C++模板初阶(个人笔记)
  • 如何用Java后端处理JS.XHR请求