Last active
August 29, 2015 14:07
-
-
Save amonmoce/59bd4cb481b07936f28e to your computer and use it in GitHub Desktop.
Updating Git to the latest version in a Mac OS Maverick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mac OS comes with a pre-installed Git. But this version is generally outdated. | |
Solution 1: | |
To update it, we can go to Git website and download the latest version available for Mac and install it. But even if you type "git --version", you will not see the latest version you have installed. How come ? | |
When you installed Git from the Git Installer, it will install the git executable in a different place than your system's default one. The default is /usr/bin/git, and the new one is /usr/local/git/bin/git. Your shell however will not pick up the later one if its PATH isn't configured properly. How to configure the PATH ? | |
You can try adding the following to your ~/.bash_profile (if you use Bash, that is): | |
export PATH=/usr/local/git/bin:$PATH | |
Then, restart your shell and see if git now points to the new version. (Test with which git or git --version). | |
Solution 2: (from http://superuser.com/questions/776726/cant-use-homebrew-installed-git but solved my problem) | |
brew uninstall git | |
# make sure everything is alright, maybe brew will give you some hint | |
brew doctor | |
brew update | |
brew install git | |
# magic happen, brew will give you hint /usr/bin occurs before /usr/local/bin | |
# and recommend you run following command | |
brew doctor | |
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment