Reputation: 2449
I just got a new Mac, the M1 Macbook pro and I am trying to install homebrew, but every time I finish installing it, it tells me that it was not written to the path, and then when I try the advised whatever to add to the path, nothing happens and the terminal or whatever does not recognize the command at all, as if it isn't installed.
This worked perfectly fine on my old Intel mac, and there is some step or whatever - I don't know anything, and I am tired and I don't understand how to install this at all, but hte path is supposed to be different for Apple silicon macs but nothing i read helps at all.
Upvotes: 234
Views: 508704
Reputation: 505
Put this line in a .zshrc file in your default home directory.
export PATH=/opt/homebrew/bin:$PATH
Upvotes: 13
Reputation: 1057
Go to Homebrew and get the install command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
When requsted in the Terminal press 'return' to finish installation
After installation, the Terminal generates the next commands to be executed:
==> Next steps:
Run these two commands in your terminal to add Homebrew to your PATH:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/$yourdevicename/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
Run brew help to get started
- Further documentation:
https://docs.brew.sh
Upvotes: 24
Reputation: 129
The answer given by Lena Bru and Camilo Lizarazo Olaya is the solution.
Especially the last code block
- Add Homebrew to your PATH in ~/.zprofile:
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> ~/.zprofile
eval $(/opt/homebrew/bin/brew shellenv)
The complete returning on Terminal is
Warning: /opt/homebrew/bin is not in your PATH.
Instructions on how to configure your shell for Homebrew
can be found in the 'Next steps' section below.
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/bohuang/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
https://docs.brew.sh
has been accepted by the official team of Homebrew.
I installed Homebrew to my new Macbook Pro (chip Apple M1 Pro). The installation was completed successfully, and threw out a hint which was same as the two command lines.
Upvotes: 5
Reputation: 5811
Homebrew installation on apple silicon, step by step:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
In my case, installation show me errors, I just installed again, and then show: Installation successful!, and warning: /opt/homebrew/bin is not in your PATH
touch ~/.zshrc
Then open it to edit with TextEdit (Is a hidden file. You can show hidden files with shift + command + . )
Add this line at the end of .zshrc
export PATH=/opt/homebrew/bin:$PATH
source ~/.zshrc
brew help
This works for me to path homebrew permanently.
Or do:
- Add Homebrew to your PATH in ~/.zprofile:
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> ~/.zprofile
eval $(/opt/homebrew/bin/brew shellenv)
Upvotes: 571
Reputation: 95
After Installing brew
Go to root folder by opening the terminal.
type: vim .zshrc if exist. Type i to start editing the .zshrc file. add line
export PATH=/opt/homebrew/bin:$PATH
After editing, press esc and save using :wq
Then run command
exec zsh
And voila, brew is ready..
Thanks, Let me know if it helps.
Upvotes: -2
Reputation: 5201
If you are getting the intel chip error
xcrun: error: unable to load libxcrun (dlopen(/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib, 0x0005): tried: '/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libxcrun.dylib' (no such file)).
then you have to fix your command line tools (CLT). What I did is the following (solution from here):
What I suggest is to uninstall the command line tools (CLT) and re-install them the official way (source).
So do (source):
sudo rm -rf /Library/Developer/CommandLineTools
check it uninstalled, you should get an output as follows:
xcode-select -p
output
xcode-select: error: unable to get active developer directory, use `sudo xcode-select --switch path/to/Xcode.app` to set one (or see `man xcode-select`)
then install the command line tools (CLT) again:
xcode-select --install
then agree to it and it should download after a couple of minutes. The download should take some time. For me ~13mins.
After that your issues with PyCharm, git, brew and likely other tools will be resolved.
After you have that resolved -- which was causing me issue when trying to install brew -- do what the top answer here recommends: https://stackoverflow.com/a/67271753/1601580 which in a summary is run the bash install of brew and make sure it is in your PATH env variable properly.
Upvotes: 0
Reputation: 2358
Seems Touch, source and export
not required now.
Run the below command in terminal
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
and follow the instructions showing in terminal itself. shows as follows:
==> Next steps:
Run these two commands in your terminal to add Homebrew to your PATH:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/xxx/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
Then, brew help
Upvotes: 92
Reputation: 117
Go To the home brew webpage
copy the script provided under Install Homebrew
Open Terminal via spotlight search
Then open the terminal in the using the spotlight search by pressing the command + spacebar
now in the terminal paste the script which was copied from the homebrew site
it will ask to click return button after some time so don't worry after successful installation the brew won't work as for M1 Chip MacBook air.
It will show some warning for the path i.e. warning: /opt/homebrew/bin is not in your PATH
==>Now on the same terminal we will create the file .zshrc in the home directory
So Run the command to create this directory i.e.
touch .zshrc
Now we will open the home directory
To open home directory we will open the finder from the dock and make sure its the active application
now in the finder app we will press button to open the home directory i.e. command+shift+H
After this finder will open the home directory
Now since the .zshrc is a hidden file as we created it using the terminal above
Now to access the hidden file press the button i.e. shift + command + .
After this locate the .zshrc file and click to edit with Text Editor option
Set the path in .zshrc file
Now at the end of the line paste this -
export PATH=/opt/homebrew/bin:$PATH
Now we will make this file available
So type paste this code in the terminal
source ~/.zshrc
After this command run one more command on the terminal to check if the howebrew is working fine
brew
On typing this you will get to know that home brew is now working!!
Now do what ever you want to do using brew either install git or any other things which you want....
Have a Good Day Guys!!
Upvotes: 10
Reputation: 1
Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
InstallOpenCV You must have Python3 installed
pip3 install opencv-python
Upvotes: -6
Reputation: 180
Also, you can check this short article out and doing it using aliases.
Upvotes: 0
Reputation: 338
open the terminal and copy below command
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
create new empty file with touch
touch .zshrc
now open the file with vim editor
vim .zshrc
now enter i to start edit mode and write
export PATH=/opt/homebrew/bin:$PATH
then press esc and type :wq
now we setup brew successfully for permanently to test enter
brew or brew help
Upvotes: 9