Brew stops working after terminal session is closed - macos

I have installed Brew in MACOS Monterey with the following commands.
mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
eval "$(homebrew/bin/brew shellenv)"
brew update --force --quiet
chmod -R go-w "$(brew --prefix)/share/zsh"
I have tested it after the install, and it works, however closing the terminal session and opening it again causes terminal to say that the command brew is not found after running it. I can still see the homebrew directory, so Im guessing its in the wrong place for terminal to run it.

The only supported method to install brew is found on brew.sh:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Ok I was able to fix the issue by adding the PATH to the .bash_profile file.

Related

Command Brew not Found?

I installed homebrew with ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" on Mac but when I try to install python3 with
brew install python3
I get error of
zsh: command not found: brew
I know brew is installed but maybe I haven't done it in right location? I am in a directory of a folder in my desktop
Output of echo $PATH | tr ':' '\n'
/usr/local/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
Thanks for the help in advance
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/neerajvishwa/.zprofile
type this in terminal - it worked for me
If using Macbook M1 chip run this after installation done
eval $(/opt/homebrew/bin/brew shellenv)
I use the MacBook Air M1 and I have the same issue, where I need to run eval $(/opt/homebrew/bin/brew shellenv) every time I open the terminal to use brew.
I reran the 2 commands we are supposed to run after installing homebrew. (You need to replace [username] by your Mac user name)
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/[username]/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
I even completely rebooted my Mac to make sure the fix was permanent.

Need sudo access on macOS - Installing Hashcat through Brew

I am trying to install Hashcat using the instructions on Brew: https://brewinstall.org/install-hashcat-on-mac-with-brew/
When I enter the first command:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
on terminal, it says:
Need sudo access on macOS (e.g. the user myname to be an Administrator)!
However, I am already an administrator when I check in Users&Groups in Systems Preferences. Typing sudo whoami also gives me back root
Can someone please help me out with this?
I'm pretty sure all you have to do is add sudo in front of the command like this:
sudo ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null

Install homebrew using Makefile

I'm trying to install Homebrew using a Makefile, the contents of the Makefile is this:
.PHONY: install
install:
# Install homebrew
/usr/bin/ruby -e $(shell curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)
However this just prints the entire contents of the script, but it does not execute anything. I got as far as googling for this issue and seeing that the characters $, (, ) have a special meaning in a Makefile, however I could not find any solution.
try just piping output from curl to ruby like this:
.PHONY: install
install:
# Install homebrew
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install | ruby
If you encounter the following warning:
Warning: The Ruby Homebrew install is now deprecated and has been rewritten in Bash.
Please migrate to the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
You can modify #igagis answer as such
.PHONY:install
install:
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash
I was running into needing sudo, then sudo telling me not to run as root so the command i used was:
sudo true
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | sudo -u $$USER bash
Notes:
I use sudo true to run sudo and do nothing. that way the user can input their password. running sudo make from the terminal caused the $USER to be root. if you remove the sudo true line, then if sudo has not been run yet, the sudo access check will fail and not let you insert a password when running the curl line
the two $ makes the makefile write a literal $

Installing brew with OS X issue

When I try to install brew with the command
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
I get the following error
/Users/nouveau/.rbenv/shims/ruby: ligne21: /usr/local/Cellar/rbenv/0.4.0/libexec/rbenv: No such file or directory
How can I solve this?
Your rbenv installation seems to be broken. Just remove it:
cd
rm -rf rbenv
rm -rf /usr/local/Cellar
exit # close terminal
Then repeat homebrew installation (with your system Ruby):
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Trouble Installing Homebrew on Mac

I am having trouble installing Homebrew on a mac. I am running Mac OS X 10.8.4.
When I try to install it through
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Or:
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
I get:
\-bash: curl: command not found
-bash: ruby: command not found
I have also tried:
cd /usr/local/bin
mkdir homebrew && curl -L https://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C homebrew
And got:
-bash: mkdir: command not found
What do you think may be wrong>

Resources