mac m1芯片安装homebrew
Arm版本
cd /opt # 切换到 /opt 目录
mkdir homebrew # 创建 homebrew 目录
sudo chown -R $(whoami) /opt/homebrew # 修改目录所属用户
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
检测是否安装成功
cd /homebrew/bin
brew --version
注意:由于arm版的homebrew可能有些软件不太兼容,所以需要安装intel版的x86进行兼容,为了两个不相冲突,需要重新命名homebrew。
安装intel版:
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
执行 vim ~/.bash_profile
# x86
$ export PATH="/usr/local/Homebrew/bin:$PATH"
$ alias xbrew='arch -x86_64 /usr/local/Homebrew/bin/brew'
# arm
$ export PATH="/opt/homebrew/bin:$PATH"
$ alias brew='/opt/homebrew/bin/brew'
执行 source ~/.bash_profile
说明:如果你需要用arm版的安装则 brew install xxx ,如果需要intel x86安装则 xbrew install xxx
最终结果可以看到:
xiaowen@xiaowendeMBP / % brew config
HOMEBREW_VERSION: >=2.5.0 (shallow or no git repository)
ORIGIN: (none)
HEAD: (none)
Last commit: never
Core tap: N/A
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_BOTTLE_DOMAIN: https://mirrors.ustc.edu.cn/homebrew-bottles
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 12.0 build 1200
Git: 2.24.3 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.0.1-arm64
CLT: N/A
Xcode: 12.4
Rosetta 2: false
xiaowen@xiaowendeMBP / % xbrew config
HOMEBREW_VERSION: 2.7.7-40-g24bbfff-dirty
ORIGIN: https://mirrors.ustc.edu.cn/brew.git
HEAD: 24bbfffc61f905a212f5fcb29e44199520024caf
Last commit: 2 weeks ago
Core tap ORIGIN: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
Core tap HEAD: 06d77104b20277c78b5a05edd782ce461d19cdf7
Core tap last commit: 13 days ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_BOTTLE_DOMAIN: https://mirrors.ustc.edu.cn/homebrew-bottles
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit westmere
Clang: 12.0 build 1200
Git: 2.24.3 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.0.1-x86_64
CLT: N/A
Xcode: 12.4
Rosetta 2: true
好了两个版本都已成功安装!美滋滋!安装太慢的话,大家可以换源,像中科大,清华的都可以。
转载:https://blog.csdn.net/weixin_43864342/article/details/113800258
查看评论