macports-installation: do I have to install xcode?

Ryan Schmidt ryandesign at
Mon Jul 8 11:01:40 UTC 2019

On Jul 4, 2019, at 12:12, Hongxia (Laura) Hao wrote:

> I am wondering if I need to install the whole xcode app before
> installing macports? Does that work if I only install the xcode
> command line tools?

As of right now, MacPorts assumes that Xcode exists, so our official recommendation is to install Xcode so that you will be able to install any port. Not all ports require Xcode, but if you try to install a port that does require it, and you have not installed it, you will get a build failure.

The decision to make MacPorts work this way dates from the early days of Mac OS X before the command line tools were a thing that you could install without installing Xcode. There is work underway for Google Summer of Code 2019 to allow individual ports to indicate whether they require Xcode so that we could provide a more user-friendly error message if Xcode is missing but needed.

We have an automated build system that produces binaries of many of our ports. If you install a port for which a binary is available, you don't need Xcode nor the command line tools; MacPorts simply downloads and installs the binary.

If you install a port for which a binary is not available but which needs to be compiled by a C/C++ compiler, either Xcode or the command line tools needs to be installed to provide that compiler. Some ports can only be compiled with a full Xcode installation present. Others can be compiled using just the files provided by the command line tools.

More information about the macports-users mailing list