Cristiano
Cristiano

Reputation: 3189

Mac - Can’t install Homebrew

I tried to install Homebrew like this:

ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"

It didn’t install correctly so I closed Terminal and tried again. Now it displays me the following 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

I tried to do that but without success. The following message is displayed:

brew: command not found

So, the problem is that Homebrew is installed but actually it is not installed. Any suggestions how to solve this problem? Thank you!

Upvotes: 13

Views: 75109

Answers (10)

iii
iii

Reputation: 510

This seems to have resolved the issue for me

rm -rf /usr/local/Cellar /usr/local/.git
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Afterward, I can now

brew doctor

You may also find the gist linked to at the following page of use:

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

Upvotes: 41

yw_maggie
yw_maggie

Reputation: 53

This is the most recent one that works for me.

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

I found it here in case it is updated later. https://brew.sh/

Upvotes: 0

user8316197
user8316197

Reputation: 45

Follow these steps 
1 ==> ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

2 ==> sudo rm -rf /usr/local/Homebrew/
      sudo rm -rf /usr/bin/Homebrew/

3 ==> install brew
      1 -- /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

      2 -- sudo chown -R $(whoami) /usr/local/var/homebrew

If get these error try below command
  Error: Failed to link all completions, docs and manpages:
        sudo chown -R $(whoami) /usr/local/*

  then follow these commands
        /usr/local/bin/brew update --force

Upvotes: 0

vtoukas
vtoukas

Reputation: 81

If you cannot install by using curl try to open the install script from your browser, save it in a file called i.e brew_install.rb somewhere on your disk and run the script locally

ruby brew_install.rb 

This worked for me.

Upvotes: 1

Sinh Thái
Sinh Thái

Reputation: 61

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

this is work for me!

Upvotes: 6

atripes
atripes

Reputation: 1723

I removed the folder /usr/local/.git and homebrew installed just fine afterwards.

Upvotes: 3

Wesley McCloy
Wesley McCloy

Reputation: 455

Attempting to resolve the same issue, I found out that I had mistyped while making changes to my PATH. I did not have /usr/local/bin. I would then recommend running

$ echo $PATH

in terminal to see if you have the correct directories.You can also run

$ vi ~/.bash_profile

to see it and make changes if neccessary

Upvotes: 2

ElephantHunter
ElephantHunter

Reputation: 1542

The URL contained in the command you are using is not correct. Ruby will dump out lines of HTML and then fail. Use this command instead:

ruby -e "$(curl -fsSkL raw.github.com/Homebrew/homebrew/go/install)"

Upvotes: 9

HasanAboShally
HasanAboShally

Reputation: 18675

This worked for me:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Upvotes: 3

DMR
DMR

Reputation: 1473

What was the message given when it didn't install correctly the first time? Is the brew binary present in /usr/local/bin ? If so, you probably just need to add it to your path, see: Error Installing Homebrew - Brew Command Not Found

Upvotes: 2

Related Questions