Can’t re-install homebrew

homebrew

I'm having a problem re-installing homebrew. I am running Mavericks

It started with me trying to install express.js. Homebrew had been installed on my mac for quite some time, never had any trouble with it. I used sudo npm install -g express, but when I ran express --version, I got command not found. Eventually, I found a possible solution online, and just tried to reinstall npm with brew remove npm and brew install npm. Again, I ran into errors (Unfortunately, I didn't save the exact errors) I used brew doctor to try and figure it out, looked up a ton of tutorials and mucked around with homebrew, and I guess I broke something.

Now, I figure I should just try and reinstall homebrew.

I run the install command for homebrew:

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

It returns this message:

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

So, I run

rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup

This returns:

-bash: brew: command not found

I try running the install command again, and this time, it doesn't tell me homebrew is already installed.

So again, I run the install command for homebrew:

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

And now I get this:

==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
Password:
==> Downloading and installing Homebrew...
remote: Counting objects: 136, done.
remote: Total 136 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (136/136), 10.37 MiB | 1.53 MiB/s, done.
Resolving deltas: 100% (44/44), done.
From https://github.com/Onomanatee/portfolio_Yuri_Legiest
* [new branch] master -> origin/master
HEAD is now at c253261 Commit4
==> Installation successful!
==> Next steps
Run brew doctor before you install anything
Run brew help to get started

Running brew doctor or brew help , however, results in

-bash: brew: command not found

I really don't know how to fix this. And why is the brew installer referring to a repository I used as a test for a little web project? (right above Installation succesful!)

Best Answer

Short term answer, try this command to see if your brew installation worked:

/usr/local/bin/brew doctor

It seems that your bash environment may not be looking in the /usr/local/bin for executibles (which means you have to write the full path rather than just the name of the command). The solution may be just resourcing your conf files, which can be roughly done by closing your terminal and opening a new one. Otherwise, you'll want to add a line to your ~/.bash_profile. I think resourcing will do the trick though.

So after confirming the success with the first doctor, try quitting your terminal application and starting fresh, then your original usage of brew should work. If it doesn't try:

echo $PATH

and report back the results.