Homebrew镜像

简介

Homebrew是一款自由及开放源代码的软件包管理系统,用以简化macOS系统上的软件安装过程。它拥有安装、卸载、更新、查看、搜索等很多实用的功能,通过简单的一条指令,就可以实现包管理,十分方便快捷。

下载地址: https://mirrors.aliyun.com/homebrew/

配置方法

安装homebrew

# 从阿里云下载安装脚本并安装 Homebrew 
git clone https://mirrors.aliyun.com/homebrew/install.git brew-install
/bin/bash brew-install/install.sh
rm -rf brew-install

# 也可从 GitHub 获取官方安装脚本安装 Homebrew 
/bin/bash -c "$(curl -fsSL https://github.com/Homebrew/install/raw/master/install.sh)"

查看homebrew版本

brew -v

设置homebrew安装源为阿里源

# 临时替换

export HOMEBREW_INSTALL_FROM_API=1
export HOMEBREW_API_DOMAIN="https://mirrors.aliyun.com/homebrew-bottles/api"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/homebrew-core.git"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.aliyun.com/homebrew/homebrew-bottles"
brew update
# 永久替换

# bash 用户
echo 'export HOMEBREW_API_DOMAIN="https://mirrors.aliyun.com/homebrew-bottles/api"' >> ~/.bash_profile
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/brew.git"' >> ~/.bash_profile
echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/homebrew-core.git"' >> ~/.bash_profile
echo 'export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.aliyun.com/homebrew/homebrew-bottles"' >> ~/.bash_profile
source ~/.bash_profile
brew update

# zsh 用户
echo 'export HOMEBREW_API_DOMAIN="https://mirrors.aliyun.com/homebrew-bottles/api"' >> ~/.zshrc
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/brew.git"' >> ~/.zshrc
echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/homebrew-core.git"' >> ~/.zshrc
echo 'export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.aliyun.com/homebrew/homebrew-bottles"' >> ~/.zshrc
source ~/.zshrc
brew update

配置tap仓库(非必需,非开发者无需配置)

# 绝大部分用户无需额外配置 tap 仓库
# 如果您需要使用 Homebrew 的开发命令,则按照如下命令配置 homebrew/core 和 homebrew/cask 镜像。
brew tap -v --custom-remote --force-auto-update homebrew/core https://mirrors.aliyun.com/homebrew/homebrew-core.git
brew tap -v --custom-remote --force-auto-update homebrew/cask https://mirrors.aliyun.com/homebrew/homebrew-cask.git

# 其他 tap 仓库按需配置即可
brew tap -v --custom-remote --force-auto-update homebrew/cask-fonts https://mirrors.aliyun.com/homebrew/homebrew-cask-fonts.git
brew tap -v --custom-remote --force-auto-update homebrew/cask-versions https://mirrors.aliyun.com/homebrew/homebrew-cask-versions.git
brew tap -v --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.aliyun.com/homebrew/homebrew-command-not-found.git
brew tap -v --custom-remote --force-auto-update homebrew/services https://mirrors.aliyun.com/homebrew/homebrew-services.git

恢复默认配置

出于某些场景, 可能需要回退到默认配置, 你可以通过下述方式回退到默认配置。

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

unset HOMEBREW_API_DOMAIN
unset HOMEBREW_CORE_GIT_REMOTE
BREW_TAPS="$(BREW_TAPS="$(brew tap 2>/dev/null)"; echo -n "${BREW_TAPS//$'\n'/:}")"
for tap in core cask{,-fonts,-versions} command-not-found services; do
    if [[ ":${BREW_TAPS}:" == *":homebrew/${tap}:"* ]]; then
        brew tap --custom-remote "homebrew/${tap}" "https://github.com/Homebrew/homebrew-${tap}"
    fi
done

brew update

# 如果您之前永久配置了 HOMEBREW 环境变量,还需要在对应的 ~/.bash_profile 或者 ~/.zshrc 配置文件中,将对应的 HOMEBREW 环境变量配置行删除

相关链接

特别声明:本镜像站内容来自第三方网站,阿里云会尽力审核镜像内容安全,但无法保证其完全合规,请您在下载前慎重考虑。具体请查看《阿里云开发者社区用户服务协议》、《阿里云镜像站特别条款》等。 如您发现镜像站有任何问题,可以填写镜像站投诉表单举报,我们将按照法律规定尽快进行处理。

推荐关注:
· 手慢无!云服务器免费领取,实时计算净省3258元 · 每周二看直播,学最新阿里开源技术

评论

登录后可评论
头像
名称
2024-07-27
https://brew.idayer.com/
Shape Created with Sketch. Combined Shape Created with Sketch.
头像
zhenxxin
2024-06-25
遇到 "Your Homebrew is too outdated for `brew services`. Please run `brew update`" 跟着操作后还是反复提醒的同学,可以看看这个:https://developer.aliyun.com/ask/642184
Shape Created with Sketch. Combined Shape Created with Sketch.
头像
过时了
Shape Created with Sketch. Combined Shape Created with Sketch.
头像
Homebrew macOS安装教程 /bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)" 将以上命令粘贴至终端。脚本内置镜像
Shape Created with Sketch. Combined Shape Created with Sketch. 1
2024-07-22
太牛了大佬~
Shape Created with Sketch. Combined Shape Created with Sketch.
头像
yaoyi2008
2023-05-02
2、重新加载环境 $source ~/.zprofile 3、更新 $brew update
Shape Created with Sketch. Combined Shape Created with Sketch.
头像
yaoyi2008
2023-05-02
1、写入中科大源 $vim ~/.zprofile 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_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git" export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" export HOMEBREW_PIP_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple"
Shape Created with Sketch. Combined Shape Created with Sketch.
头像
文档这是多久没更新了?Homebrew 4.0之后还需要配置API接口:https://mirrors.ustc.edu.cn/help/homebrew-bottles.html#id4
油炸的馍馍、物外神驰觉得很赞
Shape Created with Sketch. 2 Combined Shape Created with Sketch.
头像
Please remove the dollar signs from the documentation so that we can copy the commands and execute them verbatim.
Shape Created with Sketch. Combined Shape Created with Sketch.
头像
“brew update”命令卡住了,一直没反应。
hiloxue、425cbpy73quqe、diluka觉得很赞
Shape Created with Sketch. 3 Combined Shape Created with Sketch.
头像
新版本的brew cask已经不支持了,另外改变源的方法也换了。 具体更新方法是用:添加如下设置到.zshrc或者.bashrc export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/brew.git" export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/homebrew-core.git" 然后source ~/.zshrc 或者source ./.bashrc 然后在brew update... 文档该更新一下了。 具体参考下https://docs.brew.sh/Installation
6zczvhr3wmmau、diluka、游客ez2gxvods4wno、毋闲、一只小菜鸟la觉得很赞
Shape Created with Sketch. 6 Combined Shape Created with Sketch. 1
2022-04-17
https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/ 清华的源比较好用
Shape Created with Sketch. Combined Shape Created with Sketch.
镜像站 + 订阅

阿里巴巴镜像站技术社区

域名使用规则
  • 公网访问地址:

    https://mirrors.aliyun.com/

  • ECS VPC网络访问地址:

    http://mirrors.cloud.aliyuncs.com/

  • ECS 经典网络访问地址:

    http://mirrors.aliyuncs.com/

对于镜像有任何问题,欢迎给我们提问题!
立即提问
热门体验场景