Tuesday, June 25, 2013

How to install the latest Git on OS X

            

I've been using git v.1.7.10.2 long time, despite the fact that git v.1.8+ released several months ago. So, I've decided to updated my local git via homebrew.

$ git --version
git version 1.7.10.2 (Apple Git-33)

$ brew install git

==> Downloading http://git-core.googlecode.com/files/git-1.8.3.1.tar.gz
######################################################################## 100.0%
==> make prefix=/usr/local/Cellar/git/1.8.3.1 CC=cc CFLAGS= LDFLAGS= install
==> make CC=cc CFLAGS= LDFLAGS=
==> make clean
==> make CC=cc CFLAGS= LDFLAGS=
==> Downloading http://git-core.googlecode.com/files/git-manpages-1.8.3.1.tar.gz
######################################################################## 100.0%
==> Downloading http://git-core.googlecode.com/files/git-htmldocs-1.8.3.1.tar.gz
######################################################################## 100.0%
==> 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/1.8.3.1: 1324 files, 28M, built in 113 seconds

$ git --version
git version 1.7.10.2 (Apple Git-33)
As you can see the latest git isn't on PATH. Than I've asked the doctor's help:
$ brew doctor
Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:

    git
    git-cvsserver
    git-receive-pack
    git-shell
    git-upload-archive
    git-upload-pack
    gitk

Consider amending your PATH so that /usr/local/bin
occurs before /usr/bin in your PATH.
I.e. I need to put the homebrew git before system git:
$ echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bash_profile
After the terminal's restart I've got the next:
$ git --version
git version 1.8.3.1

No comments:

Post a Comment