14

I have git on /usr/bin/git (I think was Xcode install) but it is 1.7.5.4 and I want to use the current version 1.7.7

Is there a way to uninstall that version and use the new one?

8

None of the current answers will upgrade Xcode git. They will only install a newer version of git.

Xcode have has changed its mind several times about the best git location. Depending on how long ago you have been installing Xcode you will see git binaries at:

/usr/bin/git
/usr/local/git
/Applications/Xcode.app/Contents/Developer/usr/bin/git
/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git

Even if you update the PATH, Xcode will stick to its version. The only way I know to force it to use the newer version is replacing those git binaries by a link to the new one you installed.

ln -s /opt/local/bin/git /usr/bin/git

Repeat for the other path. Notice I use a symbolic link, not a hard one. Otherwise Xcode would replace your other installation during an upgrade

  • Yeah, everyone says "just make sure PATH is in proper order", but that doesn't work with Xcode binaries, it seems. – Marko Bonaci Sep 13 '16 at 10:18
6

You can install git from source using Homebrew, and just point your PATH to use the new one instead of the xcode/system version.

There's a little video tutorial here. http://vimeo.com/14649488

It's for an older version but it will get you started, let me know if you need more info.

(You can also use MacPorts, Fink or the Git OS X installer, to upgrade.)

6

If you want to use git itself to update git run the following commands :

This can be run from anywhere git clone git://github.com/gitster/git.git then you want to cd git then run this sudo make prefix=/usr install install-doc install-html install-info

This will install Git into your /usr/bin folder for global use.

  • 3
    It's never a good idea to overwrite system binaries. Much better to install into /usr/local/bin or $HOME/bin or similar and adjust your PATH accordingly. – zigg Nov 24 '13 at 19:28
  • As SystematicFrank said, even if you update the PATH, Xcode will stick to its version. – Marko Bonaci Sep 13 '16 at 12:36
0

You can install the latest git using macports:

sudo port install git-core +svn +doc +bash_completion +gitweb
  • 1
    I understand that this might not be the best answer, but why is this -2? – OldPeculier Dec 19 '14 at 15:24
0

If you want a newer git than the one in Xcode then you need to install it, this install should be to another place as if you update /usr/bin/git then an Apple update will overwrite this version.

There are several ways to do this but as noted by @FranciscoGarcia they won't necessarily change the one used by Xcode just the command line version.

The easiest is to install the binaries from the git site.

If you want code then use a package manager e.g. Fink macports, Homebrew.

If you want the bleeding edge latest install from git's own repository.

0

Download the latest binary from here and install.

You must log in to answer this question.

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