Sunday, October 16, 2011

Updating GIT on Mac OSX Lion

Today I had an issues that was driving me crazy, so I thought I would share my experience and hopefully it helps someone. The scenario is that you want to update your local git install to the latest version but after running the installer you still see the previous version you had. For example, when I ran the following command I would get:

git --version
git version 1.7.5.4


This is the git version installed by XCode. I expected to see git version 1.7.7 which is the latest install (at time of this post) that I downloaded from http://code.google.com/p/git-osx-installer/downloads/list.

So the first thing I tried to do is edit my .profile and .bash_profile files so I would add the correct path to use and after several attempts nothing.

You see the google installer installs git into /usr/local/git/bin/git but the version in use is /usr/bin/git which is the version installed by Xcode.

So after several attempts in editing all my .profile files that are read by the bash and attempting to put the installer's path into my $PATH variable I came into a helpful post that stated to edit the /etc/paths file and place the installer path first in the list like so:

/usr/local/git/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin


I closed my terminal window and opened a new one ran the following and ....

git --version
git version 1.7.7


.... SUCCESS!!!!

Hopefully this helps someone having the same issue I had.
Post a Comment