Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

homebrew with M1 macbook air error when starting terminals

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?

like image 759
Jinrae Kim Avatar asked Dec 21 '25 02:12

Jinrae Kim


2 Answers

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.

like image 185
Leon D Avatar answered Dec 24 '25 10:12

Leon D


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.

like image 23
Jinrae Kim Avatar answered Dec 24 '25 09:12

Jinrae Kim