0

This is actual copy/paste from my shell:

machine:~ me$ brew install git
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/git-2.2.1.mountain_lion.bottle.tar.gz
######################################################################## 100.0%
==> Pouring git-2.2.1.mountain_lion.bottle.tar.gz
==> Caveats
The OS X keychain credential helper has been installed to:
  /usr/local/bin/git-credential-osxkeychain

The "contrib" directory has been installed to:
  /usr/local/share/git-core/contrib

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completion has been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/git/2.2.1: 1356 files, 32M
machine:~ me$ 
machine:~ me$ git --version
git version 1.7.10.2 (Apple Git-33)
machine:~ me$ 

I can close Terminal and open it again, but the same Git version is shown.

Running which git returns /usr/bin/git. If I move that binary to /usr/bin/git, then run git --version again, it returns git version 2.2.1, but why does installing a new Git not replace the old one?

2 Answers 2

1

I'm no Mac/homebrew expert, but typically what happens is that when you install, it simply unpacks git to it's own, version specific, directory. /usr/bin/git is likely a symbolic link to the actual git binary in said version specific directory. All you would need to do in that case is unlink /usr/bin/git and recreate the link to the newer directory. If I were to guess at the command, not knowing your directory tree, it would be something like this:

unlink /usr/bin/git
ln -s /usr/local/Cellar/git/2.2.1/bin/git /usr/bin/git
0
2

Give export PATH="/usr/local/bin:$PATH" a try. If it works add it to your .bashrc file

You must log in to answer this question.

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