How can I permanently add Homebrew to my PATH? - terminal

I have an M1 Mac Mini. Every time I want to use brew in a new terminal, it tells me :
zsh: command not found: brew
So I always do this to solve it :
export PATH=$PATH:/opt/homebrew/bin
But then the next time I open a terminal, this has been forgotten. Is there a way to make it stick? I wonder why the homebrew installation doesn't do this by default? (It does warn me that it's not added to the path during installation).
Thanks!

Create/open the ~/.zshrc file and add this line to it: export PATH=$PATH:/opt/homebrew/bin

Related

Cannot update PATH to accommodate Homebrew commands

I am attempting to install Homebrew on MacOS but keep getting the error Warning: /opt/homebrew/bin is not in your PATH. I have updated my .zshrc to include export PATH=/usr/local/bin:$PATH but have had no such and continue to not be able to access brew commands. I am running MacOS BigSur and am attempting to set up a ruby coding environment.
By running /opt/homebrew/bin/brew doctor as noted in the warning as opposed to brew doctor I was given the correct notation for updating my .zshrc file export PATH="/opt/homebrew/bin:$PATH as opposed to export PATH=/usr/local/bin:$PATH as indicated in several answers to similar questions. After running source ~/.zshrc and brew doctor the system confirmed the path had been updated properly.

Mac OSX (Apple Silicon) Homebrew installed but brew cmd not found

I have googled around the error I was experiencing but from what I could tell this issue is likely related to how the path in which Homebrew is saved for Big Sur/Apple Silicon is different than other Macbook approaches.
Following the instructions on the Homebrew page, I ran the cURL command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
However, after the operation successfully completed, there was a warning in terminal:
warning: bin/opt/ path does not exist
And when I attempted to run a brew doctor the command was not found.
It's clear there is a pathing issue, but how do I solve it
In this case, I discovered it was a combination of a PATH issue as well as the .zshrc file was missing from the ~/ directory
I was able to resolve the issue with these steps.
Navigate to cd /opt/homebrew/bin/
Run export PATH=$PATH:/opt/homebrew/bin
Navigate back to "home" with cd ~/
in this directory I found that there was no .zshrc file (:scream:)
So I created a file with touch .zshrc and then
ran this command: echo export PATH=$PATH:/opt/homebrew/bin >> .zshrc
And after running that command, I was able to successfully use the brew doctor and other related commands!

unable to setup ssldump on mac using homebrew

I just installed ssldump on a mac computeg using brew. The installation process ran without reporting any issues (ssldump-0.9b3 already installed). However, when I try running ssldump from the same prompt or a new terminal window, the error message I get is:
-bash: ssldump: command not found
Is there anything else that i need to do to make this work on a Mac El capitan (v10.11.6)?
Simply using brew install ssldump did not work for me as ssldump was added in /usr/local/sbin (which was neither mentioned on /etc/paths nor in .bash_profile). I ended up adding /usr/local/sbin to the .bash_profile and used sourced the file to enable the change.
cd ~
sudo vi .bash_profile
add to the file:
export PATH=/usr/local/sbin:$PATH
&
source .bash_profile

Homebrew keep showing warning to set PATH on OS X 10.11

I am on Mac OSX 10.11 after running
brew doctor
And there is a warning in my terminal.
Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc
After I fixed this PATH in my .zshrc file, I run brew doctor again,
this error is still remain.
Any suggestions?
What my .zshrc file now looks like:
export PATH="$PATH:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
I finally solved this problem by restarting my terminal and run brew doctor again.
Warnings disappear!
you can resolve this problem : delete all "unbound" * in /usr/local/sbin;
Then cakebrew and homebrew doctors are OK
Have a nice day

grc.bashrc no such file or directory

I am newbie to OSX, I tried to install bash, but when I running the terminal I got this error msg: -bash: /usr/local/Cellar/grc/1.5/etc/grc.bashrc: No such file or directory
so how I can fix it?
Reading the output of brew info grc
grc: stable 1.5
http://korpus.juls.savba.sk/~garabik/software/grc.html
Conflicts with: cc65
Not installed
From: https://github.com/Homebrew/homebrew/commits/master/Library/Formula/grc.rb
==> Caveats
New shell sessions will start using GRC after you add this to your profile:
source "`brew --prefix`/etc/grc.bashrc"
suggests you look for and remove from your .bash_profile file a line similar to the last line in the output above.
I had the same issue where the shell (in my case zsh) had an error upon starting, which for me appeared after upgrading OS X.
The problem is that the brew command is called before the shell knows where the brew command is stored. To fix it, in your .bash_profile (or .zshrc) move this line:
source "`brew --prefix`/etc/grc.bashrc"
to be after this line:
export PATH=/usr/local/bin:/usr/local/sbin:$PATH

Resources