Installation on MacOS X

by Johannes Roith (johannes@jroith.de)

What you need to start

First of all you'll need to make sure you've got the Apple development tools installed. If you have got them on CD install them, if not you'll have to go to the Apple web site and get them from there. A free registration is required.

Next you need to get a couple of other things:

The easiest way to get these is by using Fink which makes it very easy. Get the latest version of fink, and run it.

sudo dselect

Find the packages (pkg-config is installed as part of fink) and let fink do it's job.

Mono

Get the 0.18 release of Mono from the Mono web site. You need the mono-0.18.tar.gz source. Unpack the files into a directory of your choice, *nix people might like to choose /usr/local/src, Mac people might like Documents/mono, it doesn't make any difference.

A few things to note first... mono doesn't actually work on OS X (yet), but mint does (a little anyway). So you should be able to compile most C# programs that compile with mono, but don't expect everything to work.

Patch for OS X

There are few changes required to get mono to work on OS X. Easy way to do this is to download the patch file from here and apply it.

patch -p1 < mono-0.18-osx.diff.patch

Second, you need a different tramp.c file. After you've applied the patch replace the mono-0.18/mono/arch/ppc/tramp.c file with the new one. (Big thanks to John Duncan for this file)

cp tramp-macosx.c mono-0.18/mono/arch/ppc/tramp.c

Compile Mono

Now it starts to get easy.... From the mono directory just type:

./configure --prefix=/usr/local

If you want mono installed somewhere other than /usr/local, put something else after the --prefix. Next type:

make

Install Mono

Another easy bit (providing all the above went ok...)

sudo make install

To get mcs (the Mono C# Compiler) to work, you will need to change the mcs file that gets created in /usr/local/bin. It tries to use mono which doesn't compile so either change the mcs file to look as shown below:

#!/bin/sh
/usr/local/bin/mint /usr/local/bin/mcs.exe "$@"

Or you can download it from here. Make sure the file has execute permissions.

chmod a+x mcs

Test Your Installation

As a simple test to make sure what you have now works, you can download the Hello World program and compile it with the command

mcs helloworld.cs

You will see a warning saying that non-atomic functions are used, but don't worry about that. Just type the next line to run your program:

mint helloworld.exe