From 2ef5adb4439786f4e08fbc100ade22fa7592bafd Mon Sep 17 00:00:00 2001 From: liruyu Date: Sun, 5 Jun 2022 10:26:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Ehomebrew=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E5=8F=8A=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Others.md | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/Others.md b/Others.md index 52a2d79..bb130d8 100644 --- a/Others.md +++ b/Others.md @@ -1481,6 +1481,126 @@ Mac 键盘符号和修饰键说明 +# homebrew + +## 自动安装homebrew + +```shell +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +``` + +参考地址:https://brew.sh/ + + + +## 手动安装homebrew + +使用homebrew脚本安装的时候 会因为访问问题失败,此时通过手动安装 使用镜像地址可以解决: + +```shell +# 创建安装文件夹 +sudo mkdir /usr/local/Homebrew + +# 直接从镜像地址git clone +sudo git clone https://mirrors.ustc.edu.cn/brew.git /usr/local/Homebrew + +# 创建链接,如果已经存在 则删除后再创建 +sudo ln -s /usr/local/Homebrew/bin/brew /usr/local/bin/brew + +# 创建core文件夹 并且完成core的clone +sudo mkdir -p /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core +sudo git clone https://mirrors.ustc.edu.cn/homebrew-core.git /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core + +# 调整权限,并运行更新 +sudo chown -R $(whoami) /usr/local/Homebrew +brew update + +# 更新环境变量(zsh或bash) +echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc +echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile +``` + + + +## 解决brew安装慢 + +### 替换brew.git仓库地址 + +```bash +cd "$(brew --repo)" +git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git +``` + +还原 + +```bash +cd "$(brew --repo)" +git remote set-url origin https://github.com/Homebrew/brew.git +``` + + + +### 替换homebrew-core.git仓库地址 + +```bash +cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" +git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git +``` + +还原 + +```bash +cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" +git remote set-url origin https://github.com/Homebrew/homebrew-core.git +``` + + + +### 替换homebrew-bottles访问地址 + +这个步骤跟你的 macOS 系统使用的 shell 版本有关系,先来查看当前使用的 shell 版本 + +```bash +echo $SHELL +/bin/zsh +``` + +#### zsh替换成阿里巴巴的homebrew-bottles访问地址 + +```bash +echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc +source ~/.zshrc +``` + +还原 + +```bash +vi ~/.zshrc +# 然后,删除 HOMEBREW_BOTTLE_DOMAIN 这一行配置 +source ~/.zshrc +``` + + + +#### bash替换成阿里巴巴的homebrew-bottles访问地址 + +```bash +echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile +source ~/.bash_profile +``` + +还原 + +```bash +vi ~/.bash_profile +# 然后,删除 HOMEBREW_BOTTLE_DOMAIN 这一行配置 +source ~/.bash_profile +``` + +配置完后再去安装下某些工具和module时就能发现畅快无比了。 + + + # Product ## Axure RP