简体   繁体   中英

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?

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

在此处输入图片说明

在此处输入图片说明

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).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM