[Mono-osx] Environment variables not set up properly

Michael Hutchinson m.j.hutchinson at gmail.com
Tue May 4 12:08:41 EDT 2010

On Sun, May 2, 2010 at 12:50 PM, bmahf <bmahf at hotmail.com> wrote:
> So MonoDevelop seems to work fine now, but as I said command line is not, so
> I just totally uninstalled my mono installation using a script I found
> online:
> -----------------------------------------------------------------------------------------------------------
> #!/bin/sh -x
> #This script removes Mono from an OS X System.  It must be run as root
> rm -r /Library/Frameworks/Mono.framework
> rm -r /Library/Receipts/MonoFramework-*
> for dir in /usr/bin /usr/share/man/man1 /usr/share/man/man3
> /usr/share/man/man5; do
>   (cd ${dir};
>    for i in `ls -al | grep /Library/Frameworks/Mono.framework/ | awk
> '{print $9}'`; do
>      rm ${i}
>    done);
> done
> -----------------------------------------------------------------------------------------------------------
> and then after installing MacPorts I used the port install mono to install
> mono.  Turns out that since I have an intel chip in my macbook pro, this
> wasn't a walk in the park, but I eventually got it going.  Mono is now
> installed, but there is no frameword folder in /Library/Frameworks, so no
> MonoDevelop doesn't work.  Ayeeee!!!
> I am just wondering why mono would install as a framework when installed
> from a downloaded dmg file, but not when installed using the port command.
> Any ideas?  One of these days I'll actually have both command line and
> MonoDevelop working and I'll be happy at last.  :)

The MonoDevelop app bundle is explicitly designed not to use the
usually-broken Mono environments provided by unofficial Mac builds of
Mono such as Macports. Please stick with the official framework unless
you know what you're doing.

You should not have had to set any of those environment variables you
did in your earlier post - mono installer is supposed to install
symlinks for all the Mono commands to /usr/bin. If it didn't, that's a
bug in the installer, but exporting just PATH (and possibly
DYLD_LIBRARY_FALLBACK_PATH) should work around it. Setting PATH may
also be necessary to override Macports, which like to put itself first
in the PATH, and overrides several of the Mono commands with
incompatible versions. The cleanest option is just to do this in your
build environment and your app's launch script, rather than overriding
your whole environment.

Also, you appear to have got some bad information somewhere regarding env vars.
1) DYLD_LIBRARY_PATH breaks things because it overrides the default
linker paths. Use DYLD_LIBRARY_FALLBACK_PATH instead.
2) You didn't *export* the other key env var - PATH
3) LD_LIBRARY_PATH and GNOME_PREFIX are irrelevant on OS X
4) C_INCLUDE_PATH is only relevant if you're embedding Mono into a native app
4) ACLOCAL_PATH is only necessary if you're using autoconf
5) PKG_CONFIG_PATH is only necessary on Mac if you're not using the
pkg-config included in the Mono framework bin directory, i.e. a
different one is before mono's in your PATH. If that is the case
you'll probably have other problems.

Michael Hutchinson

More information about the Mono-osx mailing list