Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to use the latest version of Git on my OS X computer, without success! When i write git --version, I see the pre-installed version 1.7.10.2. I would like to use 1.8.0 that i have also installed.

The docs says that the new version is installed in /usr/local/git, but I dont know where the version "in use" is located. I'm very unexperienced with the Terminal, but if you tell me what to write i can do that.

Thanks in advance!

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You can use which git to find which version of git is used and its path.

To use the most updated version you could either call it with its full path returned by which, or create a bash alias like that: alias git='/usr/local/git'

This would only be saved for current bash session. To save it for future usages, you'll have to create/modify your ~/.profile file (where ~ is the path to your Home directory, like /Users/lucas/)

It's an invisible file and you won't see it in the Finder by default. To see if such file already exists and edit it, go to your home directory : cd

Then list all files, including hidden files : ls -al (a is for all files and l to output the list in list format, not column)

You can see in the far-right column, filenames, in which we will look for .profile file.

If you see it, open it with TextEdit from Terminal : open .profile

Otherwise, if it do not exists, simply open TextEdit and create a new file:

We should have something like this :

#!/bin/bash
alias git='/usr/local/bin/git'

Save it as .profile , close your Terminal window and create a new one.

It should work ! :)

share|improve this answer
    
Thank you very much! Your answer helped me but instead of doing exactly as you said i created a .bash_profile and changed the path in vim. Now i'm finally running the latest version :) Great with ls -al also! –  HerrNilsson Oct 24 '12 at 13:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.