1

I have just upgraded git. It's now a symlink to the Cellared most recent version.

$ ls -l `which git`
/usr/local/bin/git -> ../Cellar/git/2.14.1/bin/git

However

$git --version
git version 2.11.0 (Apple Git-81)

Do I have two different versions installed at once? How can I clean up the remnants of the Apple Git-81 version?

1
  • 1
    Are you issuing these two commands in the same Terminal session? What appears for which git in a new Terminal session? Aug 11 '17 at 14:02
2

In ~/.bash_profile you should amend PATH to prefer binaries supplied by homebrew. You can do this with the line:

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

After changing .bash_profile you will need to open a new Terminal.app window to see the change take place. Alternatively, you can source ~/.bash_profile to load in the profile into the current session.

0

For me Homebrew installed into a different directory so I had to find that and add that to the PATH. Brew info git does not tell you either so you may just have to hunt for it. For me, the path below worked for me.

export PATH=/usr/local/Cellar/git/2.34.1/bin:$PATH

Then, as others said above, you must add it to your ~/bash_profile so that your PATH is changed the next time you reboot.

Note: 2.34.1 is your version number so you will have to use your version number You could also create/change a link that is probably already in /usr/local/bin to point to your path. See this link for details on how to do that: How can I create a symbolic link in Terminal? Using a link is probably the recommended way to fix this.

1
  • 1
    I‘m not at my Mac right now but Homebrew maintains a directory in /usr /local (I think it's /usr/local/opt) with symlinks to the most recent version of all installed packages. So if you use export PATH=$(brew --prefix)/opt/git/bin:$PATH you won‘t need to change PATH after each update.
    – nohillside
    Jan 8 at 20:51

You must log in to answer this question.

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