启动终端时使用 M1 macbook Air 进行自制程序时出现错误

Jin*_*Kim 16 homebrew apple-m1

我在我的 M1 MBA 上安装了 Homebrew 3.0.0。

但是,包括 iterm2 终端和 tmux 在内的每个会话都会显示以下错误消息:

/Users/jinrae/.zprofile:1: no such file or directory: opt/homebrew/bin/brew

就我而言,至少在我的使用模式中,它不会损害功能。

无论如何,我怎样才能摆脱这个消息呢?

Leo*_*n D 20

我收到此错误是因为我在 Rosetta 版本的终端上安装了brew 来安装尚未与 M1 兼容的软件包。

为了摆脱这条消息,我打开了我.zprofilenano .zprofile

第一行是

评估“$(/opt/homebrew/bin/brew shellenv)”

我只是在该行之前添加了一个 # 将其注释掉,该消息就消失了。


Jin*_*Kim 9

对于@sedavidw,/opt/homebrew/bin包含.keepme但不包含内容:

\n
/Users/jinrae/.zprofile:1: no such file or directory: opt/homebrew/bin/brew\n\xe2\x9e\x9c  bin pwd\n/opt/homebrew/bin\n\xe2\x9e\x9c  bin la\ntotal 0\n-rw-r--r--  1 jinrae  admin     0B Feb  9 11:04 .keepme\n
Run Code Online (Sandbox Code Playgroud)\n

编辑:我读到一篇文章说它homebrew安装在/opt/homebrew/binM1 Mac 中,而它安装在/usr/localIntel Mac 中。我现在正在尝试为 M1 Mac 重新安装自制程序。

\n

EDIT2:我解决了这个问题。这是由于安装了自制软件。/usr/local据我所知, Intel Mac 和/opt/homebrew/binM1 Mac都安装了自制软件。

\n

我重新安装了自制程序

\n

/bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/nrubin29/bea5aa83e8dfa91370fe83b62dad6dfa/raw/48f48f7fef21abb308e129a80b3214c2538fc611/homebrew_m1.sh)"

\n

这与官方网站中的略有不同(至少对我来说)。\n无论如何,新安装的自制程序位于/opt/homebrew/bin并且问题已解决。

\n


小智 8

如果您使用的是 Intel Mac,如上所述,Homebrew 将安装在/usr/local.因此,请修改您的.zprofile文件(位于users/<username>)以使用正确的路径。以下是内容.zprofile

eval "$(/usr/local/Homebrew/bin/brew shellenv)"
Run Code Online (Sandbox Code Playgroud)