Mono:OSX

Introduction to Mono on MacOS X

Mono 1.0 includes support for MacOS X 10.3 (Panther). The Mac/Mono community is very enthusiastic and thriving. This page describes some of the differencies and idiosyncrasies of Mono on MacOS X including packaging, application development, MacOS specific projects.

Installing Mono on MacOS X 10.3+

Visit the download page to find the latest MacOS X package. Run it and follow the instructions it supplies. This includes:

  • The Mono Runtime
  • GUI Toolkits: Windows.Forms and Gtk# for OSX.
  • SDK: C#, Visual Basic compilers, assemblers and tools
  • Manual pages.
  • MonoDevelop IDE.

This package installs as a framework to /Library/Framework (the same way the Java packages are installed). Symlinks are created for the executables in /usr/bin. If you'd like to access the mono manpages you'll have to add /Library/Frameworks/Mono.framework/Versions/Current/man to your manpath. The MacOS X Mono package does not include Gtk# (http://mono-project.com/GtkSharp), XSP or mod_mono. These will have to be compiled from source.

Uninstalling Mono on Mac OS X

Run this script in a terminal:

#!/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

Using Mono on MacOS X

At this point, you must use Mono from the command line, the usual set of commands that are available on other ports of Mono are available.

To build applications you can use "mcs", to run then you can use mono.

From a Terminal shell, you can try it out:

$ vi hello.cs 
$ mcs hello.cs
$ mono hello.exe
Hello, World
$

See the MonkeyGuide for more details about how to get started with Mono.

MonObjc

MonObjc (http://www.monobjc.net) is probably the most advanced .NET binding available on OSX: the API is very complete and there are good tutorials (http://www.monobjc.net/index.php?page=tutorials), api docs (http://api.monobjc.net/html/R_Project.htm) and samples (http://www.monobjc.net/index.php?page=sample-applications).

ObjC#

ObjC# is a transparent two way bridge that allows the CLR to access the rich underlying ObjectiveC frameworks as well as providing direct access to the CLR frameworks from the ObjectiveC language.

Cocoa#

CocoaSharp is a binding of the Cocoa APIs from MacOS X for Mono.

Cocoa# ships as part of the Mono distribution package.

Gtk# on MacOS X 10.3

While MacOS X has its own GUI toolkit (Aqua/Cocoa), it also includes support for X11 (Quartz accelerated). Gtk# (http://mono-project.com/GtkSharp), Mono's cross platform graphical toolkit runs on MacOS X.

Mono's Installer for MacOS X comes with Gtk+ and Gtk# so you can start building and running cross-platform GUI Gtk# applications that include OSX.

Running Mono applications on MacOS X

Running applications on MacOS X is very similar to linux systems, from the terminal:

mono myprogram.exe

For GTK# applications, it's easiest to run them the same way but using xterm from X11.app

A MacOS X specific Mono launcher was in development but its status is unclear today


Miscellaneous


  • Mono's new System.Windows.Forms is an effort to deliver a fully managed implementation of the GUI toolkit that will be supported by different GUI back-ends including MacOS Quartz.
  • There are no MacOS X packages available at this time for Monodoc, Gtk#, XSP, mod_mono or Monodevelop