xcode, clt or both

Ryan Schmidt ryandesign at macports.org
Mon Sep 18 23:01:20 UTC 2017


On Sep 18, 2017, at 15:19, db wrote:

> I checked the guide and searched both lists with google but don't seem to find an answer. What exactly do Xcode and the Command Line Tools provide? Are both necessary at all times or could building some ports do without either of them?

In modern times, "Xcode" means /Applications/Xcode.app and "Command line tools" means /Library/Developer/CommandLineTools and /usr/include. Modern macOS ships with shims in /usr/bin for clang and other command line utilities; those shims run the real programs located either in /Applications/Xcode.app or /Library/Developer/CommandLineTools, as per your choice using xcode-select, or present a dialog box if you haven't installed either of them yet.

In times past, specifically Snow Leopard and earlier / Xcode 3.x and earlier, the Xcode installer also installed the command line tools, unless you unchecked that option on the customize screen. The command line tools at that time were also the component that provided gcc and the other real programs in /usr/bin; there were no shims.

Some ports fail to build if /usr/include does not exist; others fail to build if a macOS SDKs does not exist. (SDKs are inside the Xcode application bundle.) We are trying to move toward a future where MacPorts recommends installing only Xcode, and not the command line tools. Jeremy has already done work on that on master, but it is not yet in a released version of MacPorts, so at present we still recommend installing both. For certain subsets of ports, you can get by with installing just one or the other. If you only plan to install binaries built on our build servers, and don't want to build any ports yourself, e.g. you set "buildfromsource never" in macports.conf, you should be able to do so using neither Xcode nor command line tools. But you never know when a port you want, or one of its dependencies, may not be available as a binary for whatever reason.

Remember in the future to address your posts to macports-users at lists.macports.org; the @lists.macosforge.org address is deprecated.



More information about the macports-users mailing list