Getting gcc4.4 to work with XCode

Landon Fuller landonf at
Sat Feb 6 11:30:57 PST 2010

On Jan 31, 2010, at 8:50 PM, William B. Clodius wrote:

> I believe that the version of gcc that I have in /usr/local was from the High Performance Computing website a couple ;years ago, when, as often happens with me, I got distracted. The version in /alt/local has the appropriate date to be from the macport distribution, I suspect that it determined that /usr/local was not from macport and /alt/local was it's fallback in that case.
> As I understand the different comments it is probably inadvisable to override the XCode gcc with the macport gcc. It is probably possible to compile an older version of gfortran and its libraries so that they work with the XCode gcc, but as the newest versions of gfortran are intended to work with the comparable version of gcc it is probably not advisable to try a new gfortran version with the XCode gcc. So it looks like i should use more standard tools, makefiles and perhaps cmake. For the moment I don't need a bleeding edge gcc, so I am going to wait until gcc 4.5 has been officially released before I play with that.

You can also install a custom Xcode plugin that will allow you to select an alternative compiler from within Xcode. I've attached the plugin that PLBlocks[1] installs in /Developer/Library/Xcode/Plug-ins. It should also be possible to install the plugin in ~/Library/Application Support/Apple/Developer Tools/Plug-ins.

You can modify the "GCC 4.2 (Plausible Blocks).xcplugin/Contents/Resources/GCC 4.2.xcspec" file to reference your own compiler version; it may be possible to ship these custom compiler plugins with the MacPorts GCC versions so that they work out of the box with Xcode, but I'll leave that as an exercise for the GCC port maintainers.

The compiler will show up like so:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: GCC 4.2 (Plausible Blocks)
Type: application/zip
Size: 1707 bytes
Desc: not available
URL: <>
-------------- next part --------------


More information about the macports-users mailing list