Mono:OSX

From Mono

Table of contents

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 Mono-core, C# compiler and man pages. 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-SVN.pkg
cd /usr/bin
for i in `ls -al | grep Mono | awk '{print $9}'`; do
rm ${i}
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.

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.

Installing 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 but packages are not yet available for it or its dependencies (which are numerous).

Today, if you want to run or develop Gtk# applications, Fink (http://fink.sourceforge.net) is the best way to install all necessary dependencies (gnome-desktop and all others). Installing GTK# on MacOS is still a little effort intensive (instructions from Geoff Norton):

    • Install the latest Mono.framework
    • Install Fink (http://fink.sourceforge.net)
    • Update fink to CVS (fink selfupdate-cvs)
    • Update fink to unstable
    • Update all fink core packages (fink update-all)
    • Install Apple X11
    • Install gnome and gtkhtml3 from fink (fink install bundle-gnome gtkhtml3 gtkhtml3-dev gtkhtml3-shlibs)
    • Have a coffee / nap / go for a walk while fink installs Gnome.
    • Install Gtk# from source to the prefix /Library/Frameworks/Mono.framework/Versions/Current (You will need to set the following environment variables: PKG_CONFIG_PATH=/sw/lib/pkgconfig:/usr/X11R6/lib/pkgconfig:/Library/

    Frameworks/Mono.framework/Versions/Current/lib/pkgconfig)

NOTE: To run Gtk# apps you need to export the following environment variable:

export DYLD_LIBRARY_PATH=/sw/lib:/Library/Frameworks/Mono.framework/Versions/Current/lib/

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

Developing applications on MacOS X

On MacOS X, developing applications is a similar experience to developing on Linux and the following instructions apply

Additionaly, the Cocoa# project is creating a number of framework and integrating Mono within the Apple XCode development chain that allow MacOS X developers to develop applications that leverage MacOS X native UI and class libraries. MonoDevelop MacOS X installation instructions follow (from Geoff Norton as well):

  • Install Gtk# as per the instructions above
  • Install Gtk# 1.0 as per the instructions above.
  • Install monodoc
  • Install gecko-sharp 0.7 or newer.
  • Install gtksourceview-sharp
  • Install monodevelop (Note: You will need to install auto* 1.9 for monodevelop to work from SVN)

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