最近忍痛割肉入手了一台MacBook Pro M1 Pro,性能确实爆炸,之前用了4年多的MBP 2017转手扔进了旧书堆里,就是这么豪横!目前这台新的M1 Pro机器的系统包括应用和环境全部是从2017款上直接同步过来的,所以基本没有动手配置过,结果今天就遇到了一个真的炸裂的问题:Homebrew掉链子了。。。
什么问题
当在终端上使用Homebrew更新或安装应用的时候,就直接报了下面的错:
brew upgrade
Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
Please create a new installation in /opt/homebrew using one of the
"Alternative Installs" from:
https://docs.brew.sh/Installation
You can migrate your previously installed formula list with:
brew bundle dump
大概意思就是说,不能在Intel版的前缀(目录)下安装ARM架构处理器的Homebrew(英语太垮,见谅)。
恍然大悟,应该就是之前直接从2017款上把Homebrew直接同步过来了,但是之前安装的是Intel版的,现在新版的M1 Pro是ARM架构,结果就导致无法正常工作了。
解决方法
解决办法需要两步,照着执行就行了:
- 安装Rosetta2
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.
If you do not agree, press CTRL-C and cancel this process immediately.
2021-11-22 11:29:21.800 softwareupdate[4364:678895] Package Authoring Error: 002-23768: Package reference com.apple.pkg.RosettaUpdateAuto is missing installKBytes attribute
Installing: 100.0%
Install of Rosetta 2 finished successfully - 使用Rosetta2重新安装Homebrew
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
等待安装完成,过程中可能需要输入开机密码,按照提示输入即可。
使用方法
按照上面两步完成操作后,在安装或更新应用时使用下面的命令即可:
arch -x86_64 brew install <package>
比如:
arch -x86_64 brew upgrade 或 arch -x86_64 brew install hugo
也就是在执行brew命令的前面增加arch -x86_64

文章评论