Mac M1安装Homebrew记录

1、异常

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

由于我是从老的MacBook Pro迁移到M1的,所以老的Homebrew版本在M1 ARM上已经不可用了。

2、安装Homebrew

2.1、执行安装命令

/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"

国内环境可用

安装需要电脑密码:

==> Checking for `sudo` access (which may request your password).
Password:

输入会继续执行下载安装。

安装完成会有提示:
在这里插入图片描述

可以执行命令brew help验证是否安装完成。

2.2、配置环境

如上图所示,需要配置一下Homebrew环境

2.2.1、终端类型

先查看自己的终端类型

执行命令:

echo $SHELL

在这里插入图片描述

执行结果:

  • /bin/bash => bash => .bash_profile
  • /bin/zsh => zsh => .zprofile

2.2.2、配置环境

在你的.bash_profile文件或.zprofile文件中添加安装完成所提示的环境配置。

在访达的个人空间中,快捷键command+shift+.可以把隐藏文件显示出来。

我的按照提示即添加如下:

cho 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/yechao/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

然后执行命令刷新环境即可

source ~/.bash_profile 

or

source ~/.zprofile

ok,剩下的就是自己玩耍了。

3、相关资料

  • https://docs.brew.sh/Installation
  • https://brew.idayer.com/guide/m1/
  • https://stackoverflow.com/questions/66666134/how-to-install-homebrew-on-m1-mac

猜你喜欢

转载自blog.csdn.net/yechaoa/article/details/127273479