From d96fe98b8b8730897c1b4c2fa0d38bcd54b24ef0 Mon Sep 17 00:00:00 2001 From: XuehaiPan Date: Fri, 5 Mar 2021 22:02:56 +0800 Subject: [PATCH] Update docs for Homebrew --- help/_posts/1970-01-01-homebrew-bottles.md | 17 ++++++------ help/_posts/1970-01-01-homebrew.md | 29 ++++++++------------- help/_posts/1970-01-01-linuxbrew-bottles.md | 18 ++++++++++--- 3 files changed, 35 insertions(+), 29 deletions(-) diff --git a/help/_posts/1970-01-01-homebrew-bottles.md b/help/_posts/1970-01-01-homebrew-bottles.md index f3c3cbc..3c0fe7f 100644 --- a/help/_posts/1970-01-01-homebrew-bottles.md +++ b/help/_posts/1970-01-01-homebrew-bottles.md @@ -9,22 +9,23 @@ mirrorid: homebrew-bottles **注:该镜像是 Homebrew 二进制预编译包的镜像。本镜像站同时提供 Homebrew 的 formula 索引的镜像(即 `brew update` 时所更新内容),请参考 [Homebrew 镜像使用帮助](https://{{ site.hostname }}/help/homebrew/)。** ### 临时替换 + ```bash -export HOMEBREW_BOTTLE_DOMAIN=https://{{ site.hostname }}/homebrew-bottles +export HOMEBREW_BOTTLE_DOMAIN="https://{{ site.hostname }}/homebrew-bottles" ``` ### 长期替换 -如果你使用 bash: +如果你使用 bash: ```bash -echo 'export HOMEBREW_BOTTLE_DOMAIN=https://{{ site.hostname }}/homebrew-bottles' >> ~/.bash_profile -source ~/.bash_profile +echo 'export HOMEBREW_BOTTLE_DOMAIN="https://{{ site.hostname }}/homebrew-bottles"' >> ~/.bash_profile +export HOMEBREW_BOTTLE_DOMAIN="https://{{ site.hostname }}/homebrew-bottles" ``` -如果你使用 zsh: +如果你使用 zsh: -```zsh -echo 'export HOMEBREW_BOTTLE_DOMAIN=https://{{ site.hostname }}/homebrew-bottles' >> ~/.zprofile -source ~/.zprofile +```bash +echo 'export HOMEBREW_BOTTLE_DOMAIN="https://{{ site.hostname }}/homebrew-bottles"' >> ~/.zprofile +export HOMEBREW_BOTTLE_DOMAIN="https://{{ site.hostname }}/homebrew-bottles" ``` diff --git a/help/_posts/1970-01-01-homebrew.md b/help/_posts/1970-01-01-homebrew.md index ebdef2d..159e5ec 100644 --- a/help/_posts/1970-01-01-homebrew.md +++ b/help/_posts/1970-01-01-homebrew.md @@ -6,7 +6,7 @@ mirrorid: homebrew ## Homebrew / Linuxbrew 镜像使用帮助 -**注:该镜像是 Homebrew / Linuxbrew 源程序以及 formula/cask 索引的镜像(即 `brew update` 时所更新内容)。本镜像站同时提供相应的二进制预编译包的镜像,请参考 [Homebrew bottles 镜像使用帮助](https://{{ site.hostname }}/help/homebrew-bottles/) 和 [Linuxbrew bottles 镜像使用帮助](https://{{ site.hostname }}/help/linuxbrew-bottles/)。** +**注:该镜像是 Homebrew / Linuxbrew 源程序以及 formula / cask 索引的镜像(即 `brew update` 时所更新内容)。本镜像站同时提供相应的二进制预编译包的镜像,请参考 [Homebrew bottles 镜像使用帮助](https://{{ site.hostname }}/help/homebrew-bottles/) 和 [Linuxbrew bottles 镜像使用帮助](https://{{ site.hostname }}/help/linuxbrew-bottles/)。** ### 首次安装 Homebrew / Linuxbrew @@ -27,31 +27,24 @@ export HOMEBREW_BOTTLE_DOMAIN="https://{{ site.hostname }}/${BREW_TYPE}-bottles" 最后,在终端运行以下命令以安装 Homebrew / Linuxbrew: ```bash -# 从本镜像下载安装脚本,修改其中被硬编码的仓库源(改为从环境变量读入)并安装 Homebrew / Linuxbrew +# 从本镜像下载安装脚本并安装 Homebrew / Linuxbrew git clone --depth=1 https://{{ site.hostname }}/git/homebrew/install.git brew-install -/bin/bash -c "$(sed -E 's#^(\s*)(HOMEBREW_(BREW|CORE)_GIT_REMOTE)=(.*)$#\1\2="${\2:-\4}"#' brew-install/install.sh)" +/bin/bash brew-install/install.sh rm -rf brew-install -# 也可从 GitHub 获取官方安装脚本,修改其中被硬编码的仓库源,运行以安装 Homebrew / Linuxbrew -/bin/bash -c "$( - curl -fsSL https://github.com/Homebrew/install/raw/master/install.sh | - sed -E 's#^(\s*)(HOMEBREW_(BREW|CORE)_GIT_REMOTE)=(.*)$#\1\2="${\2:-\4}"#' -)" +# 也可从 GitHub 获取官方安装脚本安装 Homebrew / Linuxbrew +/bin/bash -c "$(curl -fsSL https://github.com/Homebrew/install/raw/master/install.sh)" ``` -这样在首次安装的时候也可以使用镜像。 +这样在首次安装的时候也可以使用镜像。更多信息请参考 [Homebrew 官方安装文档](https://docs.brew.sh/Installation)。 _* 安装成功后需将 brew 程序的相关路径加入到环境变量中:_ - _以下针对基于 Apple Silicon CPU 设备上的 macOS 系统(命令行运行 `uname -m` 应输出 `arm64`)上的 Homebrew:_ ```bash - grep -qF '/opt/homebrew/bin' /etc/paths || sudo sed -i "" '1i \ - /opt/homebrew/bin - ' /etc/paths - grep -qF '/opt/homebrew/share/man' /etc/manpaths || sudo sed -i "" '1i \ - /opt/homebrew/share/man - ' /etc/manpaths + test -r ~/.bash_profile && echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bash_profile + test -r ~/.zprofile && echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile ``` _对基于 Intel CPU 设备上的 macOS 系统(命令行运行 `uname -m` 应输出 `x86_64`)的用户可跳过本步。_ @@ -61,9 +54,9 @@ _* 安装成功后需将 brew 程序的相关路径加入到环境变量中:_ ```bash test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)" test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >>~/.bash_profile - test -r ~/.profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >>~/.profile - test -r ~/.zshrc && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >>~/.zshrc + test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile + test -r ~/.profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.profile + test -r ~/.zprofile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.zprofile ``` _参考了 [https://docs.brew.sh/Homebrew-on-Linux](https://docs.brew.sh/Homebrew-on-Linux)。_ diff --git a/help/_posts/1970-01-01-linuxbrew-bottles.md b/help/_posts/1970-01-01-linuxbrew-bottles.md index 957ba53..5b01e54 100644 --- a/help/_posts/1970-01-01-linuxbrew-bottles.md +++ b/help/_posts/1970-01-01-linuxbrew-bottles.md @@ -9,12 +9,24 @@ mirrorid: linuxbrew-bottles **注:该镜像是 Linuxbrew 二进制预编译包的镜像。本镜像站同时提供 Linuxbrew 的 formula 索引的镜像(即 `brew update` 时所更新内容),请参考 [Linuxbrew 镜像使用帮助](https://{{ site.hostname }}/help/homebrew/)。** ### 临时替换 + ```bash -export HOMEBREW_BOTTLE_DOMAIN=https://{{ site.hostname }}/linuxbrew-bottles +export HOMEBREW_BOTTLE_DOMAIN="https://{{ site.hostname }}/linuxbrew-bottles" ``` ### 长期替换 + +如果你使用 bash: + ```bash -echo 'export HOMEBREW_BOTTLE_DOMAIN=https://{{ site.hostname }}/linuxbrew-bottles' >> ~/.bash_profile -source ~/.bash_profile +test -r ~/.bash_profile && echo 'export HOMEBREW_BOTTLE_DOMAIN="https://{{ site.hostname }}/linuxbrew-bottles"' >> ~/.bash_profile +test -r ~/.profile && echo 'export HOMEBREW_BOTTLE_DOMAIN="https://{{ site.hostname }}/linuxbrew-bottles"' >> ~/.profile +export HOMEBREW_BOTTLE_DOMAIN="https://{{ site.hostname }}/linuxbrew-bottles" +``` + +如果你使用 zsh: + +```zsh +echo 'export HOMEBREW_BOTTLE_DOMAIN="https://{{ site.hostname }}/linuxbrew-bottles"' >> ~/.zprofile +export HOMEBREW_BOTTLE_DOMAIN="https://{{ site.hostname }}/linuxbrew-bottles" ```