13

I am a newbie of Mac user. I can see there are gcc, git, etc in the "/usr/bin" folder. But when I want to use them, it prompts like this:

MacBook-Pro:~ nan$ git
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.
MacBook-Pro:~ nan$ gcc
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.

Does it mean I must install xcode to use gcc or git, thanks very much in advance!

8

No you don't, at least not anymore. The possibility mentioned by @jherran involves installing yet another piece of software. If that's ok with you, you can use Hombrew or Macports. Its controversial which one is 'better', so take which one you like.

But, since OSX Yosemite (or maybe earlier, not sure), the Command Line Tools can be installed separately, which is great since it allowed me to ditch the huge useless XCode app sitting idly on my hard drive. The most straightforward way might be to simply download the right package from Apple here.

When issuing the commands you mentioned, does a window pop up prompting you to install the Command Line Tools? It is outlined here that this is what should happen.

Or, just try to run

xcode-select --install

Which should do what you want. They can be updated via the App store, at least on Yosemite.

Note that if the executables are present in /usr/bin, you should be able to call them with their full name, e.g. /usr/bin/git.

4

You could install both of them using Homebrew:

brew install gcc
brew install git

To install homebrew, you just need this single command:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Anyway, if you want to use git and gcc installed on you system, you don't need to install Xcode, instead you just need to install the command line developer tools, that you can install by typing:

xcode-select --install
  • Why there are gcc or git in "/usr/bin"? They are not executable files? Why can't use them directly? – Nan Xiao Dec 13 '14 at 10:27
  • Both tools exists but are outdated. Git on yosemite is on version 1.9.3, homebrew version is 2.2.0. Anyway, you don't need to install Xcode, just need the command line developer tools, and you can install by typing xcode-select --install. – jherran Dec 13 '14 at 10:33
  • Thanks for your answer! Why tools which outdated can't be used? Could you explain or give some links about it? Thanks! – Nan Xiao Dec 13 '14 at 10:36
  • Are outdated, but of course you can use it. But, in order to work you need the command line developer tools, don't know why, but it's a fact. – jherran Dec 13 '14 at 10:38
  • Hombre needs command line tools which include a C/C"" compiler and git - so hombre does not give you anything for just those – Mark Dec 13 '14 at 19:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .