tags:

views:

610

answers:

2

I'm looking to work on an application that needs to run on both Windows and OSX. Since I'm already very familiar with C#/.NET I thought I would take a look at using Mono. But I also want it to very easy to install and don't want the users to have to install the Mono package separately. Is it possible to create an OS X .app bundle that simply includes EVERYTHING? That is, my app, resources and the complete Mono runtime?

+6  A: 

Yes, you can do this. Pick an app, any app, and Show Package Contents. Explore around a bit and you'll see that there's a Contents/MacOS directory inside. It will contain a file with the execute bit set. This can be machine code or any old script with a #! line at the beginning. All you need to do is duplicate the directory structure with a skeleton app, shove your Mono runtime into the Resources directory somewhere, and write a bash script that initializes everything. There may be automated utilities for doing this floating around somewhere, but it's pretty easy to do this manually.

My RMUD.app project uses Java/JRuby/Profligacy to build the GUI, and uses this technique. Feel free to use its structure as a starting point.

Bob Aman
awesome answer. I'm sure it's not recommended, though...
Yar
Thanks. In any case, it really depends on what you mean by "not recommended". If you did it 100% manually, then yeah, absolutely, that's a bad idea. Would be some serious deployment issues there. But the first step to automating something is knowing how to do it manually. To clarify, if there's no pre-built packaging tool to do this for the Mono runtime, write a quick script to automate this, and insert it into your build process.
Bob Aman
By "initializes everything", what do you mean? Do you mean that it starts calls a command line function like "mono hello.exe"? Could you point us to a link? Thanks.
Maxim Zaslavsky
Yes, that's what I mean, though you could really do anything you want there. In fact, you could potentially have that script be the entire program. However, if you're going to pass control to another program, I recommend using `exec` to do it. I don't really have a link since I discovered this by experimentation.
Bob Aman
+1  A: 

It is possible, with quite a bit of hacking and some toolchain fun to compile a .NET app statically targeted for the Mac OS platform, no need to deploy mono with it. Check out this website talking about how Mono is being used statically in some iPhone apps.

http://arstechnica.com/open-source/news/2009/01/open-source-mono-framework-brings-c-to-iphone-and-wii.ars

Another great resource is the #mono channel on irc.gnome.org or irc.gimp.net (http://mono-project.com/IRC)

Norman H