NAnt using Mono on Mac OS X

less than 1 minute read

The Basics

The Out-of-the-Box-Problem

 $ echo '<?xml version="1.0"?><project name="test"></project>' > test.build

$ nant
NAnt 0.85 (Build 0.85.2344.0; rc4; 06/02/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net

BUILD FAILED

The current runtime framework 'mono-2.0' is not correctly configured in the NAnt configuration file.
Unable to locate 'mono' module using pkg-config. Download the Mono development packages from http://www.mono-project.com/downloads/.

For more information regarding the cause of the build failure, run the build again in debug mode.

Try 'nant -help' for more information

The One-Line Solution

 $ export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Libraries/pkgconfig

$ nant
NAnt 0.85 (Build 0.85.2344.0; rc4; 06/02/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///Users/xtof/test.build
Target framework: Mono 2.0 Profile

BUILD SUCCEEDED

Total time: 0 seconds.

The Permenant Solution

Change the installed ‘’‘/usr/bin/nant’’’ by one that solves the PKG_CONFIG_PATH issue.

#!/bin/sh
export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Libraries/pkgconfig
/Library/Frameworks/Mono.framework/Commands/mono \
/Library/Frameworks/Mono.framework/Libraries/NAnt/NAnt.exe "$@"

Categories: