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.

My OS X comes with a version of git installed in /usr/bin. However, this version is older than the official stable one. I would like to upgrade it.

  1. Can I use Homebrew to upgrade this version? Or would Homebrew install git in a separate location?

If Homebrew installs git in a separate location:

  1. How would my terminal know which version/location of git to run? Was I supposed to update PATH in my shell after installing brew?

  2. How would Spotlight know which version/location of Git to use?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Can I use brew to upgrade this version?

No. That is the default version installed by Xcode / developer tools. I would leave it as-is.

Or would brew install git in a separate location?

Yes, in /usr/local/bin/git, which links to a version installed in /usr/local/Cellar.

(Note that unlike Homebrew, the official OS X Git Installer installs to /usr/local/git/bin.)

How would my terminal know which version/location of git to run? Was I supposed to update PATH in my shell after installing brew?

Typically you don't need to because Homebrew by default does not ship anything that comes with OS X anyway. But if you want Homebrew commands that are duplicates of native commands to come first, edit your PATH in your ~/.bash_profile:

export PATH=/usr/local/bin:$PATH

After a restart of the shell or re-sourcing the path, the git should come from Homebrew. Run which -a git to see all installed Git binaries.

How would spotlight know which version/location of git to use?

I'm not sure what the purpose would be, since Spotlight is used for finding documents that can be opened in some application—or GUI applications—but git by itself cannot be opened.

I suspect that Spotlight does not find any of the git executables unless they exist in your user's home directory, e.g. ~/bin.

share|improve this answer

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.