Issues installing Git under Mac OS X 10.9 (Mavericks)

29

10

I've just completed a fresh install of Mavericks. Then I went to git-scm.com and downloaded the Mac installer and installed Git from that.

Now whenever I go into the terminal and type git I get this:

xcode-select: note: no developer tools were found at '/Applications/Xcode.app', 
requesting install. Choose an option in the dialog to download the command line 
developer tools.

I also this dialog:

enter image description here

The git installer installed git into /usr/local/git/bin and I've added this to my PATH but still no dice.

What am I doing wrong here? I don't want to install xcode just so I can use git.

Jan Hančič

Posted 2013-10-27T19:22:18.687

Reputation: 325

Answers

44

Just download the original git package. The installer will install git under /usr/local/git (you need to deactivate security options to run the installer).

There is a preinstalled git wrapper in /usr/bin used by Xcode which does not work without installing Xcode. You need to run /usr/local/git/bin/git explicit or change the PATH variable to contain /usr/local/git/bin before /usr/bin!

Create/edit your ~/.profile with the following:

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

Arne Burmeister

Posted 2013-10-27T19:22:18.687

Reputation: 576

Thanks, it worked. Installing Xcode to use git, how ridiculous this Apple idea is :( – Tien Do – 2014-10-07T05:57:34.633

The solution worked only in ~/.bash_profile and after reloading the bash_profile using source ~/.bash_profile – Ariful Haque – 2015-11-02T02:26:38.597

Is there a way to remove that wrapper from xcode? – Jan Hančič – 2013-10-27T19:33:59.477

@JanHančič: Yes, sudo rm /usr/bin/git, but not recommended! – Arne Burmeister – 2013-10-27T19:36:18.483

And for the record, I've done everything you said (as mentioned in OP). But I don't seem to know how to put my custom path before the existing ones. But I'd still prefer if I could just get rid of the (to me) useless wrapper ... – Jan Hančič – 2013-10-27T19:37:07.990

@JanHančič: Yes /etc/profile uses path_helper (try man path_helper to get an idea) – Arne Burmeister – 2013-10-27T19:44:10.077

Weird, I've defined the path as per your edit and it's still at the end (and I have restarted all my terminal apps). – Jan Hančič – 2013-10-27T19:50:57.007

Yes, but should be at start and end, don't worry about the duplicate! – Arne Burmeister – 2013-10-27T19:52:18.983

3Try it with ~/.profile instead and relaunch terminal app – Arne Burmeister – 2013-10-27T19:56:58.750

1This works now yes. I guess my .bashrc doesn't get picked up somehow. Thanks! – Jan Hančič – 2013-10-27T20:01:15.127

2For me worked the above but in ~/.bash_profile – Chux – 2013-12-27T23:25:05.083

1

For Mac OS X 10.10 (Yosemite) add:

/usr/local/git/bin

As the first line to /etc/paths and remove /etc/paths.d/git file to avoid duplication. This will affect all users.

igor

Posted 2013-10-27T19:22:18.687

Reputation: 149

-1

Just set an alias so when you call the git command it calls the right one instead of the wrapper...

alias git="/usr/local/git/bin/git" 

Mac-mini:/$ git -version
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.

Mac-mini:/$ alias git="/usr/local/git/bin/git"

Mac-mini:/$ git -version
Unknown option: -version
usage: git [--version] [--help] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

Rich Nason

Posted 2013-10-27T19:22:18.687

Reputation: 11