This is what I get when I try to install Homebrew: Error: Git is unavailable
Downloading and installing Homebrew...
Error: Git is unavailable
It gives me an error and says that Git is unavailable, although I have downloaded Git and installed it.
This is what I get when I try to install Homebrew: Error: Git is unavailable
Downloading and installing Homebrew...
Error: Git is unavailable
It gives me an error and says that Git is unavailable, although I have downloaded Git and installed it.
Make sure that you have your brew updated. First run the following command:
brew doctor
Now, if you get Your system is ready to brew
, you can move on to install Git.
With Homebrew, installing Git is as easy as this:
brew update
brew install git
Note: it's a good habit to run update before installing anything with Homebrew because Homebrew is updated regularly.
To verify:
git --version
You should get git version 2.3.1
or later.
Run brew doctor
to make sure everything is still working.
In case brew doctor
doesn't work you can use these commands:
cd `brew --prefix`
git remote add origin https://github.com/Homebrew/homebrew.git
git fetch origin
git reset --hard origin/master
brew update
Already up-to-date.
If you're seeing permission errors tried running
sudo chown -R $(whoami) $(brew --prefix)
Or if it complains that any directories inside /usr/local
aren't writable, fix it with this command:
sudo chown -R `whoami` /usr/local
Lastly, if you get Warning: /usr/bin
occurs before /usr/local/bin
, run the command below and quit and relaunch Terminal:
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
This command takes everything between the single quotes and adds it >>
to a file called .bash_profile
in your user's root directory ~/
. Every time you open a new Terminal window or tab, .bash_profile
is called. The export PATH
line tells your system to look in /usr/local/bin
first, since that's where Homebrew installs tools.
Inside the Terminal window, copy and paste (or type) the following command, and press the return key on your keyboard:
xcode-select --install
You should see the pop up below on your screen. Click Install when it appears.
Click Agree when the License Agreement appears.
Your computer will then attempt to find the software, and then will start downloading it. The following popup will appear:
Once the software is installed, click Done. That's it! You're now ready to go to Step 2.
So the PATH
was getting filtered, setting
export HOMEBREW_NO_ENV_FILTERING=1
helped avoid this issue
If you see the message "Error: Git is unavailable" it usually means that the git part of the brew installation is broken. To have a better hint of what's wrong with your installation, try running this:
ls -ld `brew --prefix`/.git
If you downloaded brew from git, then obviously you already have git. So this error means you have a broken $PATH or broken brew symlink or something wonky with your brew installation.
I also had this error, but after I fixed my $PATH to ensure the good brew was first, then this error vanished.
This solved my issue