3

I installed brew before, but it does not work now.

When I run brew, it gives me the error -bash: brew: command not found

So I tried to reinstall using the code

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

But it gives me another one :

It appears Homebrew is already installed. If your intent is to reinstall you should do the following before running this installer again: rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup

If I use the command rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup, it gives back the first error : -bash: brew: command not found

What should I do now?

  • What is your $PATH – Mark Oct 9 '14 at 1:03
  • and check permissions. – user90735 Oct 9 '14 at 2:00
  • 1
    Piping curl to bash/executable prompt.... ARRRRGGGHHHHHHHH – Fake Name Jan 1 '16 at 4:23
  • Find who specified that as a good idea, and please hit them for me. – Fake Name Jan 1 '16 at 4:23
  • @FakeName Its at the top of the Hombrew page so the same people who thought it best to chnage the permissions on /usr/local to one user out of many. It is the idea to make it simpler to do things. – Mark Feb 8 '16 at 18:49
7

"Command not found" indicates that the brew binary isn't on one of the directories listed in your PATH environment variable. To check what your path is currently, run echo $PATH. By default, brew installs to /usr/local/bin. To set the path permanently, you should edit your ~/.bashrc file to contain the line export PATH="/usr/local/bin:$PATH".

  • yes, I already did it. – cindywmiao Oct 9 '14 at 16:34
  • did you also rebooted your mac? this is mandatory after changes in bash/bashrc/bash_profile – AlessioX Feb 8 '16 at 18:40
  • @Alessiox no it is not necessary to reboot the mac - only need to start a new Terminal and run from there (or even on most cases resource ~/.bash_profile – Mark Feb 8 '16 at 18:51
1

The FAQ has a section on this and a specific uninstall script, start there to get a clean system and then install again.

https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md

To uninstall Homebrew, paste the command below in a terminal prompt.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

Download the uninstall script and run ./uninstall --help to view more uninstall options.

0

the -bash: brew: command not found error means that it didn't find the brew environment variable on your Mac.

The correct environment configuration in .bash_profile file should be like this:

export PATH="/usr/local/bin:$PATH"

So if you haven't config the brew environment variable, the correct step to config the brew environment variable on your Mac is:

  1. add the environment variable to your mac, the correct command is:

    echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
    
  2. Now we need to activate the changes. Type this command to activate and try drew doctor again:

    source .bash_profile
    

    Or if you had config the environment, you can use this command to open the file to check if the environment configuration is correct:

    /usr/bin/open ~/.bash_profile
    

    and then fix it to the correct text and then save and quit.

  3. Don't forget to activate your changes also. Still this command:

    source .bash_profile

-1

Following command doesn't work if your are under proxy.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Instead use following -

ruby -e "$(curl -x http://DOMAIN%5cUSER_NAME:PASSWORD@PROXY:PORT -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Note we have to use %5c instead of "\" Similarly if your password has any special character replace it with unicode e.g for @ use %40 Refer this Unicodes

Replace above command with your own params

DOMAIN - Your Domain

USER_NAME - Your User Name

PASSWORD - password

PROXY - 10.10.10.10

PORT - 8080

-2

Might be that you just never downloaded.. I made that mistake. Thought I'd downloaded right, but found out I hit something other then return when it says to "press return to continue or any other key to cancel"

  • No because the OP says he gets the error "It appears Homebrew is already installed. " – Mark Feb 6 at 12:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .