homebrew
安装homebrew
https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/
bash
# 先设置环境变量
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"
# 从本镜像下载安装脚本并安装 Homebrew / Linuxbrew
$ git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git brew-install
$ ./brew-install/install.sh
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
(echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> /Users/jade/.zprofile
eval "$(/usr/local/bin/brew shellenv)"
- Run these commands in your terminal to add the non-default Git remotes for Homebrew/brew and Homebrew/homebrew-core:
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/jade/.zprofile
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"' >> /Users/jade/.zprofile
echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"' >> /Users/jade/.zprofile
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"
rm -rf brew-install验证安装成功
bash
$ brew --version可用命令
bash
$ brew doctor
$ brew install git
$ brew uninstall
brew update
brew upgradebash
$ brew install openssl
lockf: 200: already locked
Error: Another `brew vendor-install ruby` process is already running.
Please wait for it to finish or terminate it to continue.
Error: Failed to install Homebrew Portable Ruby (and your system version is too old)!解决:rm -rf /usr/local/homebrew/locks
rm -f /Users/admin/Library/Caches/Homebrew/downloads/*.lock
rm -rf /usr/local/homebrew/.git/index-lock
如果是M芯片将“/usr/local”替换为“/opt”