Reputation: 419
I installed homebrew 3.0.0 on my M1 MBA.
However, every session including iterm2 terminal and tmux shows this error message:
/Users/jinrae/.zprofile:1: no such file or directory: opt/homebrew/bin/brew
In my case, it does not harm functionality at least in my usage pattern.
Anyhow, how can I get rid of this message?
Upvotes: 16
Views: 29410
Reputation: 61
Try this
Open your terminal and run following command
sudo nano ~/.zprofile
replace the eval "$(/opt/homebrew/bin/brew shellenv)"
with eval "$(/usr/local/bin/brew shellenv)"
and save.
Upvotes: 2
Reputation: 402
I got this error because I installed brew on the Rosetta version of terminal to install packages, that are not yet M1 compatible.
To get rid of this message i opened my .zprofile
with nano .zprofile
.
The first line was
eval "$(/opt/homebrew/bin/brew shellenv)"
And i simply put a # before this line to comment it out and the message was gone.
Upvotes: 23
Reputation: 11
I have the M1 Mac and it was installed in /opt/homebrew/...
I opened /Users/~username~/.zprofile and it had two lines.
First line was:
eval "$opt/homebrew/bin/brew shellenv"
Second like was:
eval "$(/opt/homebrew/bin/brew shellenv)"
I just commented out the first line which doesn't actually have the </opt/> in the address. It's asking for a $opt, and then the address. So commenting out that line removed the location error and just read the correct line. So it doesn't show the error anymore when opening the terminal.
Upvotes: 0
Reputation: 91
If you are using an Intel Mac, as mentioned above, Homebrew gets installed on /usr/local.
Therefore, modify your .zprofile
file (located in users/<username>
) to use the correct path. Here is content of .zprofile
:
eval "$(/usr/local/Homebrew/bin/brew shellenv)"
Upvotes: 9
Reputation: 94
To Fix Type
nano .zprofile
then delete all of the stuff
then do ⌃X
then press return
Upvotes: 0
Reputation: 419
To @sedavidw, /opt/homebrew/bin
contains .keepme
without contents:
/Users/jinrae/.zprofile:1: no such file or directory: opt/homebrew/bin/brew
➜ bin pwd
/opt/homebrew/bin
➜ bin la
total 0
-rw-r--r-- 1 jinrae admin 0B Feb 9 11:04 .keepme
EDIT: I read an article saying that homebrew
is installed in /opt/homebrew/bin
in M1 Mac whereas it is installed in /usr/local
in Intel Mac. I'm trying to reinstall homebrew for M1 Mac now.
EDIT2: I solved the problem. It was due to for what homebrew is installed. As I heard, homebrew is installed in /usr/local
for Intel Mac and /opt/homebrew/bin
for M1 Mac.
I reinstalled homebrew with
/bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/nrubin29/bea5aa83e8dfa91370fe83b62dad6dfa/raw/48f48f7fef21abb308e129a80b3214c2538fc611/homebrew_m1.sh)"
which is slightly different from that in the official site (at least to me).
Anyhow, newly installed homebrew is located in /opt/homebrew/bin
and the problem has been solved.
Upvotes: 9