'Do i need to install Command Line Tools for Xcode separately if i already have Xcode

I tried to install gcc 5.2 (already installed dependencies successfully) from source file on my computer one week ago, but it failed at make phase or make install phase because of missing some ****.h files, whatever, i can not remember clearly.

I searched the reason online, and looks like it is because i did not installed Command Line Tools for Xcode. But I already have Xcode 7.1.1 and i think it includes the Command Line Tool. I find it from File -> New -> project -> OS X Application -> Command Line Tool. I can also use gcc --version in the terminal.

So do i need to install Command Line Tools separately? If I need, and why?



Solution 1:[1]

did you try to download it like described in the attached images:

enter image description here

enter image description here

Solution 2:[2]

If you have installed Xcode you have installed command line tools too. Xcode installs command line tools automatically the first time you open it ("Installing additional components" is the message you see on the screen).

Actually xcode cannot function without the command line tools (build, git etc).

Solution 3:[3]

short answer: no, you don't.

this is the official description for the Command Line Tools for Xcode (from the https://developer.apple.com/download/all/):

This package enables UNIX-style development via Terminal by installing command line developer tools, as well as macOS SDK frameworks and headers. Many useful tools are included, such as the Apple LLVM compiler, linker, and Make. If you use Xcode, these tools are also embedded within the Xcode IDE.


long answer: it depends.

for example, if you're using homebrew package manager it requires CLT (from homebrew member comment https://github.com/Homebrew/brew/issues/10714#issuecomment-786663987)

The reason we need the Command Line Tools rather than just Xcode.app is for a few reasons:

  • The CLT contains more SDKs than Xcode - Xcode usually only contains one SDK, and it may be newer than your OS, while the CLT always has a compatible SDK. Having a matching SDK is very important for some formulae.
  • The CLT is in a fixed location /Library/Developer/CommandLineTools while Xcode is not. This matters as some formulae (including Python) bake in paths into files at compile-time - if they pointed to Xcode then it will only work for people who have Xcode installed in the same place.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 M.Alatrash
Solution 2 Nikos M.
Solution 3 kaznovac