Homebrew共存arm和X86
背景
部分包支持arm,部分支持x86,主要是x86和arm的包的位置不一样
arm安装
cd /opt
sudo mkdir homebrew
sudo chown -R $(whoami) /opt/homebrew
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
|
x86 安装
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
|
区分二个版本的brew
export PATH="/usr/local/bin:$PATH" alias abrew='arch -x86_64 /usr/local/bin/brew'
export PATH="/opt/homebrew/bin:$PATH" alias brew='/opt/homebrew/bin/brew'
|
需要出去source ~/.zshrc
换源
cd "$(abrew --repo)" git remote set-url origin git://mirrors.ustc.edu.cn/brew.git
cd "$(abrew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-core.git
|
需要出去source ~/.zshrc
配置环境变量:
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
|
需要出去source ~/.zshrc
关闭brew每次升级
export HOMEBREW_NO_AUTO_UPDATE=true
|
如何查看当前brew的版本
brew config > HOMEBREW_VERSION: 4.1.17 ORIGIN: https://mirrors.ustc.edu.cn/brew.git HEAD: 35746e0a6ba6c3c5cfe56d99f79d9ec9f52ee15f Last commit: 2 days ago Core tap origin: https://github.com/Homebrew/homebrew-core Core tap HEAD: cfa52a1f3d877a726b6006f4413000b3437c2709 Core tap last commit: 4 hours ago Core tap branch: master Core tap JSON: 24 Oct 09:20 UTC HOMEBREW_PREFIX: /usr/local HOMEBREW_API_DOMAIN: https://mirrors.ustc.edu.cn/homebrew-bottles/api HOMEBREW_BOTTLE_DOMAIN: https://mirrors.ustc.edu.cn/homebrew-bottles/bottles HOMEBREW_CASK_OPTS: [] HOMEBREW_MAKE_JOBS: 8 HOMEBREW_NO_AUTO_UPDATE: set Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby CPU: octa-core 64-bit westmere Clang: 14.0.0 build 1400 Git: 2.37.1 => /Library/Developer/CommandLineTools/usr/bin/git Curl: 8.1.2 => /usr/bin/curl macOS: 12.6.8-x86_64 CLT: 14.2.0.0.1.1668646533 Xcode: N/A Rosetta 2: true
abrew > HOMEBREW_VERSION: >=2.5.0 (shallow or no git repository) ORIGIN: (none) HEAD: (none) Last commit: never Core tap JSON: 24 Oct 09:20 UTC HOMEBREW_PREFIX: /opt/homebrew HOMEBREW_API_DOMAIN: https://mirrors.ustc.edu.cn/homebrew-bottles/api HOMEBREW_BOTTLE_DOMAIN: https://mirrors.ustc.edu.cn/homebrew-bottles/bottles HOMEBREW_CASK_OPTS: [] HOMEBREW_MAKE_JOBS: 8 HOMEBREW_NO_AUTO_UPDATE: set Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby CPU: octa-core 64-bit arm_firestorm_icestorm Clang: 14.0.0 build 1400 Git: 2.37.1 => /Library/Developer/CommandLineTools/usr/bin/git Curl: 8.1.2 => /usr/bin/curl macOS: 12.6.8-arm64 CLT: 14.2.0.0.1.1668646533 Xcode: N/A Rosetta 2: false
|