26

I bought a new MacBook Pro and installed the applications list below in order. On my old MacBook, also running OS X 10.6.6, I didn't have /usr/bin/git, however, on the new MacBook Pro, I do. The only differences that I can think of between the two systems are:

  1. New MacBook Pro has Xcode 4 vs. Xcode 3 on old MacBook
  2. New MacBook Pro installed git using homebrew vs. old MacBook installed [git-osx-installer][]

Homebrew installed git 1.7.4.1 into /usr/local/Cellar/git and symlinked it into /usr/local/bin. This leads me to believe that Xcode 4 installed git 1.7.3.4 into /usr/bin. Can anyone confirm or deny this?

If Xcode 4 didn't install git 1.7.3.4 into /usr/bin, any thoughts what program did?

Applications Installed in Order

  • First boot
  • Ran Apple's Software Update
  • Ran Bootcamp to create 48GB NTFS partition for Windows 7
  • Installed iWork '09 and ran software update to install iWork Update 5
  • Installed TextExpander 3.2.4
  • Installed Dropbox 1.0.20
  • Installed 1Password 3.5.9
  • Installed Alfred 0.8.2 (107)
  • Installed Adium 1.4.1
  • Started installation of Xcode4 via App Store
  • Installed Caffeine 1.1.1 via App Store
  • Installed Kindle via App Store
  • Completed installation of Xcode 4 via App Store
  • Installed Homebrew using the following command: ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"
  • Installed git using brew install git
  • Installed MacVim using brew install macvim

Update: Package Receipt Info

I ran pkgutil --file-info /usr/bin/git and the following info was displayed. This appears to incriminate Xcode 4.

volume: /
path: /usr/bin/git

pkgid: com.apple.pkg.GitLeo
pkg-version: 4.0.0.9000000000.1.1248867338
install-time: 1300459157
uid: 0
gid: 0
mode: 755

Why It's a Problem that Xcode 4 Installs git

By default, the path /usr/local/bin is after /usr/bin (see the file /etc/paths). This means that git 1.7.3.4 is used instead of 1.7.4.1 that Homebrew installed.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Matthew Rankin
  • 457,139
  • 39
  • 126
  • 163
  • 5
    You can set a custom path in your .bashrc or .bash_profile script too: https://github.com/adamv/dotfiles/blob/master/bashrc#L14 – Adam Vandenberg Mar 20 '11 at 00:11
  • @Adam Vandenberg: Yes, I've customized the path in `~/.bash_profile`. Just seems weird to add `/usr/local/bin` to the path via `~/.bash_profile` when `/usr/libexec/path_helper` adds `/usr/local/bin` to the path by default. See SO question: http://stackoverflow.com/q/5364614/95592 – Matthew Rankin Mar 21 '11 at 12:30

6 Answers6

17

Yes, it does. I just finished the Xcode 4 install. git was previously installed to /usr/local/git.

I am new to OS X, and can only suggest swapping the order of those directories in /etc/paths.

Not sure what else would/might work.

Guy Allard
  • 194
  • 1
  • 2
10

Under Preferences, Downloads there was an option for Command Line Tools. I installed that and it worked well.

jdownie
  • 101
  • 1
  • 2
6

I just looked into this and found git in /Applications/Xcode.app/Contents/Developer/usr/bin after installing Xcode from the App Store on 10.7.4. Adding that directory to my PATH seems to have done the trick.

gk5885
  • 3,742
  • 21
  • 16
  • This is the new correct answer. It happens because Apple deleted the special /Developer path in order to treat Xcode more like an 'app'. Do we have any reason why the install didn't add `/Apps/Xcode.../usr/bin` to our `$PATH`s already? – lol Dec 31 '13 at 01:33
2

I had to install the command line tools. Here's a helpful answer https://github.com/mxcl/homebrew/issues/10244#issuecomment-4013781

Victor
  • 3,395
  • 1
  • 23
  • 26
1

Xcode 4 installs git at /Developer/usr/bin and at /usr/bin. Xcode 4 uses the version at /Developer/usr/bin. I believe Xcode 4 also invokes git with a full path, so changing the path variable won't change the version of git being used by Xcode 4 itself. Of course, if you are just using git outside of Xcode, none of this matters.

Erik
  • 7,479
  • 8
  • 62
  • 99
0

I have been dealing with that same problem. Since I added the new default push style to my git command several programs have been failing because they were still using some internal old version of git.

I think I gave a good temporal solution here:

https://apple.stackexchange.com/a/72524/26545

Community
  • 1
  • 1
SystematicFrank
  • 16,555
  • 7
  • 56
  • 102