首页 > 其他分享 >Homebrew 换源

Homebrew 换源

时间:2024-01-19 16:35:00浏览次数:22  
标签:git cn cask 换源 https homebrew brew Homebrew

使用镜像源

自 brew 4.0.0 (2023 年 2 月 16日) 起,HOMEBREW_INSTALL_FROM_API 会成为默认行为,无需设置。大部分用户无需再克隆 homebrew-core 仓库,故无需为 homebrew-core 仓库换源。

设置 git 远程仓库,使用清华源:

# brew
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
# services
git -C "$(brew --repo homebrew/services)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git
# cask-fonts
git -C "$(brew --repo homebrew/cask-fonts)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git
# cask-versions
git -C "$(brew --repo homebrew/cask-versions)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-versions.git

设置环境变量,在你的 ~/.zshrc/~/.bash_rc 中添加以下内容:

export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
export HOMEBREW_PIP_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple"

运行 brew update 使你的设置生效。

使用官方源

# brew
git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew && \
# homeberw-cask-fonts
git -C "$(brew --repo homebrew/cask-fonts)" remote set-url origin https://github.com/Homebrew/homebrew-cask-fonts
# homebrew-cask-versions
git -C "$(brew --repo homebrew/cask-versions)" remote set-url origin https://github.com/Homebrew/homebrew-cask-versions
# homebrew-services
git -C "$(brew --repo homebrew/services)" remote set-url origin https://github.com/Homebrew/homebrew-services
unset HOMEBREW_API_DOMAIN HOMEBREW_BOTTLE_DOMAIN HOMEBREW_PIP_INDEX_URL

在你的 ~/.zshrc/~/.bash_rc 中删除以下内容:

export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
export HOMEBREW_PIP_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple"

运行 brew update 使你的设置生效。

附录:各镜像站参考文档

Homebrew / Linuxbrew 镜像使用帮助 | 清华大学开源软件镜像站

Homebrew 源使用帮助 | USTC Mirror

Homebrew 镜像 | 阿里巴巴开源镜像站

Homebrew 镜像使用帮助 | 腾讯软件源

标签:git,cn,cask,换源,https,homebrew,brew,Homebrew
From: https://www.cnblogs.com/Undefined443/p/17974968

相关文章

  • Homebrew
    1.介绍Homebrew是一款包管理工具,目前支持macOS和Linux系统。主要有四个部分组成:brew、homebrew-core、homebrew-cask、homebrew-bottles。2.安装2.1执行安装脚本执行/bin/zsh-c"$(curl-fsSLhttps://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)",镜像选......
  • pip永久换源
    第一步:文件管理器文件路径地址栏输入:%APPDATA%,快速进入C:\Users\电脑用户\AppData\Roaming文件夹中第二步:在Roaming文件中新建pip文件夹,并在文件夹中新建pip.ini配置文件第三步:在pip.ini配置文件中书写以下内容:[global]index-url=https://mirrors.aliyun.com/pypi/s......
  • pnpm切换源后报错ERR_PNPM_REGISTRIES_MISMATCH
    工具都是有利有弊,使用pnpm过程中经常会出现一个错误:Thismodulesdirectorywascreatedusingthefollowingregistriesconfiguration:{"default":"https://registry.npmjs.org/"}.Thecurrentconfigurationis{"default":"https://registry.npm.taob......
  • pnpm切换源后报错ERR_PNPM_REGISTRIES_MISMATCH
    工具都是有利有弊,使用pnpm过程中经常会出现一个错误:Thismodulesdirectorywascreatedusingthefollowingregistriesconfiguration:{"default":"https://registry.npmjs.org/"}.Thecurrentconfigurationis{"default":"https://registry.npm.ta......
  • 安装Homebrew
    1.简介一款包管理工具,目前支持macOS和Linux系统。主要有四个部分组成:brew、homebrew-core、homebrew-cask、homebrew-bottles。2.安装1.执行/bin/zsh-c"$(curl-fsSLhttps://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)",镜像选阿里巴巴,30分钟左右,安装完成。2......
  • 【换源】git命令行迁移仓库
    直接gitclone的话,查看本地分支,会只有默认主分支,可能是master,也可以能是设置的。查看所有分支gitbranch-a*masterremotes/origin/HEAD->origin/masterremotes/origin/branch1remotes/origin/branch2只有一个分支在本地gitpull只会把主分支推送上去。(本地有的)可......
  • Homebrew学习(一)之初认识
    Homebrew学习(一)之初认识 HomebrewHomebrew是一款MacOS平台下的软件包管理工具,拥有安装、卸载、更新、查看、搜索等很多实用的功能。简单的一条指令,就可以实现包管理,而不用你关心各种依赖和文件路径的情况,会自动下载相关依赖,十分方便便捷(缺失包管理器)Homebrew能干什么?......
  • Homebrew学习(二)之安装、卸载、更新
      安装请先看总结!!!!!1、网上的安装方法都是用curl,从官网找到命令复制到终端,然后回车,结果报错请求超时/usr/bin/ruby-e"$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)"然后自己试了一下这个链接  https://raw.githubusercontent.......
  • homebrew学习(三)之homebrew命令
      安装homebrew:/usr/bin/ruby-e"$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)"卸载homebrew:$cd`brew--prefix`$rm-rfCellar$brewprune$rm`gitls-files`$rm-rLibrary/HomebrewLibrary/A......
  • homebrew学习(四)之取消homebrew自动更新
      homebrew自动更新使用brewinstall/brewcaskinstall安装软件总是先updatingHomeBrew…,速度很慢取消homebrew自动更新方法一:使用命令行,但每次重启后需要重新执行命令exportHOMEBREW_NO_AUTO_UPDATE=true方法二:如果想要重启后设置依然生效,可以把上面这行加入到......