I am trying to install homebrew on m1 MacBook but I am getting this error message every time when I try to run this command.
Please anyone help me to fix this.
How to install HomeBrew on new MacBook: macOS Big Sur
install HomeBrew from terminal Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After installation, we need to change path
Warning: /opt/homebrew/bin is not in your PATH.
==> Installation successful!
To change path, follow Next steps: - Add Homebrew to your PATH in /Users/username/.zprofile As mentioned in terminal:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/username/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
All done ready to use brew, check HomeBrew version:
brew --version
Output
Homebrew 3.1.5
Homebrew/homebrew-core (git revision 5741ae3fec; last commit 2021-05-08)
Ok, I managed to figure this out after being pointed in the right direction. Full details can be found here: https://github.com/Homebrew/homebrew-cask/issues/100633
In summary, my ISPs (Virgin Media) Web Safe Settings were on, and this resulted in some issue with connecting to github (ping GitHub.com via terminal and search the IP to see where its pointing to), so had to turn off the web settings, rebooted my router just in case and used a new terminal window to ping github.com again and noticed a change in the IP address. Tried reinstalling Homebrew again and it worked!!
in my case, i fix the problem open the terminal as rosseta.
finder - application - utility - terminal - right mouse button - 'bring the imformation (i'm not sure, i'm korean user)' - check the 'open with the rosseta' - and try install homebrew again ! !
(copy-paste Homebrew with the terminal)
and...
==> Installation successful!
But, you will get a warning " /opt/homebrew/bin is not in your PATH". Then, follow the Next steps guide showed in terminal to finish add Homebrew to your PATH.
To end, type "brew -v" to check installed brew version.
Related
I just got a new Macbook and did the migration from my old one. It looks like the homebrew executables have a bad CPU type and don't work. Things are a bit stuck right now and I'm not sure how to move forward.
Even my ls is mapped to lsd and I can't list files.
Do I have to manually uninstall brew and related executables by deletion and start over?
DISCLAIMER: I didn't test this myself.
If you don't want to alwasy use Rosetta2, you have to manually remove the Intel version of Homebrew, then install the M1 version.
You can save the list of your Intel installed package with:
brew list > myHomebrewPackages.txt
You will then have to reinstall them on the M1 version.
To remove the Intel version, download the uninstall script from the official Homebrew github repository. Make it executable with:
chmod +x uninstall.sh
and run it with:
./uninstall.sh --path=/usr/local
Then install the M1 version with:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
The M1 version of Homebrew will be installed under /opt/homebrew.
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?
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.
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.
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)"
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.
To Fix Type
nano .zprofile
then delete all of the stuff
then do ⌃X
then press return
My system was installed by a friend and I have very low knowledge about linux system since I'm most used to Windows. I am on a Yosemite mac. My node was installed by brew install node, I have npm installed and from jslint install I get this error:
zsh: correct jslint to slit [nyae]? n
zsh: command not found: jslint
The fix seems to be from this website, a directory to PATH must be added.
export PATH="/usr/local/share/npm/bin:${PATH}"
I have low knowledge about the location of that file. Can I get where to find it or some introductory explanation?
Running echo $PATH; I get:
/usr/local/mysql/bin:/usr/local/share/npm/bin:/Users/frontend/.rvm/gems/ruby-2.1.3/bin:/Users/frontend/.rvm/gems/ruby-2.1.3#global/bin:/Users/frontend/.rvm/rubies/ruby-2.1.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/frontend/.rvm/bin:/Users/frontend/.yadr/bin:/Users/frontend/.yadr/bin/yadr
From web this is the source that gave me a hint how to fix it.
ls -a
vi .bash_profile
Add export PATH="$HOME/.node/bin:$PATH"
Then install again npm install -g jslint
So I've been using homebrew to install various packages/libraries/programs on my mac. I keep running into a problem in which homebrew tells me that I have unlinked kegs in my Cellar.
For instance, upon running brew install phantomjs I received the following message:
Warning: Could not link phantomjs. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link phantomjs'
Possible conflicting files are:
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs
I tried running brew link phantomjs as recommended, and hit a similar problem:
Error: Could not symlink file: /usr/local/Cellar/phantomjs/1.9.2/bin/phantomjs
Target /usr/local/bin/phantomjs already exists. You may need to delete it.
To force the link and overwrite all other conflicting files, do:
brew link --overwrite formula_name
The command brew link --overwrite --dry-run phantomjs gives the following message:
Would remove:
/usr/local/bin/phantomjs -> /usr/local/lib/node_modules/phantomjs/bin/phantomjs
I will probably go ahead and overwrite, but this appears to happen every time I try to install something with homebrew. Why? Why isn't homebrew working as expected?
Thanks.
From what I can tell, looks like you have previously done:
% sudo npm install -g phantomjs
In this case, you should do the following:
% sudo npm uninstall -g phantomjs
% brew link --overwrite phantomjs
I thought I'd take a crack at this. I ran into a similar problem today, and I think it may be related to this:
https://github.com/Homebrew/homebrew/issues/22408
Long story short, I think it has to do with how npm manages packages vs how brew does it. (I'm assuming you installed node with its defaults, which would have given you npm).
At some point you probably installed some package with npm. Maybe grunt, karma, etc..those by default end up in /usr/local/lib/node_modules.
Maybe one of those packages or its dependencies(or sub-dependencies) depended on phantomjs (I think Karma might use phantomjs?) Anyways, if now you are trying to brew install phantomjs, which is trying to make a symlink to it, that may be conflicting with the already existing symlink that npm created for you..
I think you can change the symlink path for that package so that brew permanently points to that already installed package in the node_modules folder. Sorry not to be more specific, I'm just figuring this out myself.
How can I prevent the following warning from Homebrew appearing whenever I install something?
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
Note that I've never (that I recall) installed Fink on this machine and I just uninstalled Macports. I've tried removing /opt/local/bin from my PATH to no avail.
Did you follow the official guide? (specially the "rm" part)
Looking at the source (in def macports_or_fink_installed?), it seems to check something like this:
$ which port
$ which fink
$ ls /sw/bin/fink /opt/local/bin/port # if they exist
$ ls -ld /sw /opt/local # if either directory exists it must be readable
It's a dirty hack but if you just want to silence the warning you can comment out the relevant parts of check_macports in $(brew --prefix)/Library/Homebrew/cmd/install.rb.