Xcode and Git for MacOSX Mountain Lion

I just installed Mountain Lion and Xcode, so in /Applications/Xcode.app/Contents/Developer/usr/bin I found the Git directory

But when I use Git commands in the shell terminal, it returns a command error not found . Any suggestions? I have many Git repos on my mac, so I would like to reuse them without checking them again: /

+4
source share
2 answers

You need to install the command line tools (see Xcode → Settings → Downloads), or you can download it from the Apple Developer website .

+6
source

First of all, installing the Xcode command line tools is probably not what you want. See this post for more information:

http://www.cocoanetics.com/2012/07/you-dont-need-the-xcode-command-line-tools/

You want to set up symbolic links or aliases that point to the git versions (and svn, etc.) that exist inside Xcode.app. This will automatically get new versions when updating Xcode through the app store. Installing the command line tools only confuses the questions, because you will find yourself around several versions of git, and you will have to manually update the command line tools.

The commands you will need are:

 sudo xcode-select --switch /Applications/Xcode.app # tells 'xcrun' where to look 

And then in your shell profile, for example .bash_profile :

 alias git='xcrun git' # use 'xcrun' to locate the git binary 

Now launching "git" from the terminal will use the latest version inside Xcode.app.

+3
source

Source: https://habr.com/ru/post/1439184/


All Articles