Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-bash: brew: command not found after pkg install and adding brew shellenv to bash #16803

Closed
3 tasks done
Jarrod-RDS opened this issue Mar 3, 2024 · 4 comments · Fixed by #16805
Closed
3 tasks done
Labels
bug Reproducible Homebrew/brew bug outdated PR was locked due to age

Comments

@Jarrod-RDS
Copy link

brew doctor output

I have read the above, but please understand the software is not working yet, I cannot produce output from non-functioning software. There are no other avenues for support except this github, so this is my only option.

Verification

  • My "brew doctor output" above says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update twice and am still able to reproduce my issue.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

brew config output

no output

What were you trying to do (and why)?

use the software

What happened (include all command output)?

vi .bash_profile
added 'brew shellenv' as the final line, saved.
$ source .bash_profile
-bash: brew: command not found

I grabbed the full path to brew and edited .bash_profile last line to:
/opt/homebrew/bin/brew shellenv

I sourced the file again and was shown:
export HOMEBREW_PREFIX="/opt/homebrew";
export HOMEBREW_CELLAR="/opt/homebrew/Cellar";
export HOMEBREW_REPOSITORY="/opt/homebrew";
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}";
export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:";
export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}";

brew is still not found.
$ brew help
-bash: brew: command not found
'which brew' returns null

if I echo $PATH the path does not show an entries for /opt/homebrew/bin or /opt/homebrew/sbin

I am trying to follow the Installation instructions but they are not working

Running the command directly produces same results
$ /opt/homebrew/bin/brew shellenv

I have looked in Common Issues, FAQ nothing there about this. The Installation document has zero information on this https://docs.brew.sh/Installation The final page of the pkg installer is what is instructing me to add this to add homebrew to path

If you expect user to manually edit their path because this 'shellenv' does nothing then please provide the steps you would like them to take in Installation document.

What did you expect to happen?

the software to respond

Step-by-step reproduction instructions (by running brew commands)

see 'what happened' above for step by step
@Jarrod-RDS Jarrod-RDS added the bug Reproducible Homebrew/brew bug label Mar 3, 2024
@Shaxzodbek16
Copy link

I have also the problem . What will I do to fix the problem?

@ZhongRuoyu
Copy link
Member

You should add eval "$(/opt/homebrew/bin/brew shellenv)" to ~/.bash_profile instead of plain /opt/homebrew/bin/brew shellenv.

ZhongRuoyu added a commit that referenced this issue Mar 3, 2024
The existing instructions is perhaps not clear enough:

  To add Homebrew to your `PATH` run `brew shellenv` in your shell
  profile (e.g. `~/.bash_profile` or `~/.zprofile`)

Fixes #16803.
ZhongRuoyu added a commit that referenced this issue Mar 3, 2024
The existing instructions is perhaps not clear enough:

  To add Homebrew to your `PATH` run `brew shellenv` in your shell
  profile (e.g. `~/.bash_profile` or `~/.zprofile`)

Fixes #16803.
ZhongRuoyu added a commit that referenced this issue Mar 3, 2024
The existing instructions is perhaps not clear enough:

  To add Homebrew to your `PATH` run `brew shellenv` in your shell
  profile (e.g. `~/.bash_profile` or `~/.zprofile`)

Fixes #16803.
@Shaxzodbek16
Copy link

Shaxzodbek16 commented Mar 3, 2024 via email

@Jarrod-RDS
Copy link
Author

Ok to close. I see less people will have the same confusion moving forward with those commits to improve clarity of directions

@github-actions github-actions bot added the outdated PR was locked due to age label Apr 3, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/brew bug outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants