diff --git a/help/_posts/1970-01-01-homebrew.md b/help/_posts/1970-01-01-homebrew.md index fdbcc39..4dce76e 100644 --- a/help/_posts/1970-01-01-homebrew.md +++ b/help/_posts/1970-01-01-homebrew.md @@ -28,6 +28,8 @@ BREW_REPO="https://{{ site.hostname }}/git/homebrew/brew.git" 接着,运行 `install.sh` 以安装 Homebrew: ```bash +# brew 运行时会从 Homebrew bottles 中拉取一个包 +export HOMEBREW_BOTTLE_DOMAIN=https://{{ site.hostname }}/homebrew-bottles HOMEBREW_CORE_GIT_REMOTE=https://{{ site.hostname }}/git/homebrew/homebrew-core.git bash install.sh ``` @@ -75,17 +77,26 @@ git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/H brew update ``` -### 安装 Linuxbrew 时使用 tuna 镜像 (可用 `sudo`) +### 安装 Linuxbrew 时使用 tuna 镜像 -1. 安装 git -2. 下载 `https://raw.githubusercontent.com/Linuxbrew/install/master/install-ruby` -3. 将其中 `https://homebrew.bintray.com/bottles-portable-ruby/` 换为 `https://{{ site.hostname }}/homebrew-bottles/bottles-portable-ruby/` -4. 运行 `./install-ruby` 安装 portable ruby -5. `export PATH=/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/current/bin:$PATH` # ==> Add Ruby to your PATH -6. 下载 `https://raw.githubusercontent.com/Linuxbrew/install/master/install` -7. 将其中 `https://github.com/Homebrew/brew` 换为 `https://{{ site.hostname }}/git/homebrew/brew.git` -8. 运行 `./install` 安装 brew -9. 执行到 `==> Tapping homebrew/core` 时 Ctrl-C -10. `export PATH=/home/linuxbrew/.linuxbrew/Homebrew/bin:$PATH` # 将 brew 添加到 PATH -11. `git clone https://{{ site.hostname }}/git/homebrew/linuxbrew-core.git "$(brew --repo homebrew/core)"` -12. 再次运行 `./install` 即可到达安装成功结果 +#### 使用 Homebrew/install + +Linuxbrew/install 现在已经废弃,被合并入 Homebrew/install。故可遵循「首次安装Homebrew」进行操作。 + +在安装 Linuxbrew 前,需要安装 git。 + +#### 直接安装 brew + +参考了 [https://docs.brew.sh/Homebrew-on-Linux](https://docs.brew.sh/Homebrew-on-Linux) + +直接使用以下脚本即可 + +``` +git clone https://{{ site.hostname }}/git/homebrew/brew.git ~/.linuxbrew/Homebrew +mkdir ~/.linuxbrew/bin +ln -s ~/.linuxbrew/Homebrew/bin/brew ~/.linuxbrew/bin +export HOMEBREW_CORE_GIT_REMOTE=https://{{ site.hostname }}/git/homebrew/homebrew-core.git +export HOMEBREW_BOTTLE_DOMAIN=https://{{ site.hostname }}/homebrew-bottles +eval $(~/.linuxbrew/bin/brew shellenv) +brew update +```