简体   繁体   中英

Install another version of Git on mac osx lion

On my mac, first I installed the xcode which is installed with git already, however the git is old version. When I run which git, the result is: "/usr/bin/git".

I want to install latest version of git, and use this as the default git. I tried the way on this site: http://git-scm.com/book/en/Getting-Started-Installing-Git

First, i update to the xcode version of git, it doesn't work.

Then, I tried to download new version of git and install it in the usr/local/git directory, when I run the command "make prefix=/usr/local all", I got some problem:

ld: library not found for -lintl
collect2: ld returned 1 exit status
make: *** [git-credential-store] Error 1

Anybody knows how to fix this problem?

Also, I tried to download the dmg file and it is installed successfully, but when I run the command git --version, it is still the old version.

Thanks.

Edit ~/.profile so that the path to the new git directory is before the path to the old git directory so it always find it (and associated files) first. Without this, you will find that the new git will look for supporting files using the system path and will get the ones for the old git, causing a problem.

Add this line to .profile

export PATH=/path/to/new/git:$PATH

Then close and reopen the terminal to reload it and do echo $PATH to check.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM