Mac M1(arm版本)安装homebrew

简介

  • Homebrew是一款包管理工具,目前支持macOS和linux系统。主要有四个部分组成: brew、homebrew-core 、homebrew-cask、homebrew-bottles。

安装

  • 打开终端(复制以下命令在终端中回车执行)

  • 设置镜像
    HOMEBREW_CORE_GIT_REMOTE=https://mirrors.ustc.edu.cn/homebrew-core.git

  • 执行安装脚本
    /bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"

  • 安装需要几分钟,等待安装完成会提示配置环境变量如图:

  • 复制终端中提示要配置的环境变量并执行
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/grant/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"

  • 验证提示Already up-to-date.表示成功
    brew update

修改镜像

  • 更换镜像地址
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
  • 更换homebrew-core镜像地址
cd "$(brew --repo)" 
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" 
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
  • 更新
brew update
posted @ 2022-02-10 21:12  白玉神驹  阅读(827)  评论(0)    收藏  举报