When I have abc.exe generated from C#/Mono source, I use 'mono abc.exe'.

Is there a way to run abc.exe with 'abc.exe' not 'mono abc.exe'? I mean, when I run 'abc.exe', can I make 'mono abc.exe' called automatically?

  • maybe someone else knows how to configure the system for direct execution, but this might be a question for stackoverflow. Commented Dec 16, 2010 at 15:35
  • @calavera There’s no “JAR” equivalent in mono, you need the mono runtime, as far as I can remember. Commented Dec 16, 2010 at 19:38

3 Answers 3


See this link

Basically what you have to do is to use one of the Mono tools (mkbundle is a generic one while macpack is designed to work on Mac OS X) to link all your application executables, resources and dll in a single executable file that can be later run as a single app.

From the macpack doc:

macpack is a tool that must be used to bundle Cocoa# applications into Double-Clickable, Finder friendly, bundles on Mac OS X. It bundles static libraries and resources, as well as generates a basic info.plist into the .app bundle.

For example the following commands are used to build the CurrencyConverter.exe into an application bundle:

$ mcs -g -debug+ CurrencyConverter.cs -out:CurrencyConverter.exe -pkg:cocoa-sharp
$ rm -rf CurrencyConverter.app
$ macpack -m:2 -o:.  -r:/Library/Frameworks/Mono.framework/Versions/Current/lib/    
  libCocoaSharpGlue.dylib -r:CurrencyConverter.nib -n:CurrencyConverter 

The resulting CurrencyConverter.app is just another Mac OS X application as far as the Finder is concerned, and can be opened from Finder, or launched from Terminal using the open -a CurrencyConverter command.

  • sounds like bundling or the macpac would be the way to go, unless he just wants something really simple. Commented Dec 16, 2010 at 23:30
  • could you include some recommendations based on that link in the text of your answer? link rot is always a problem over time, but if you put it here and just reference your source, it will remain useful in the future. Commented Dec 17, 2010 at 18:37

Improving Calavera’s answer to allow you to do it with a parameter, the script should look like:

mono $1

That way you can do:

./abc.sh name_of_the_app.exe

I would have added this as a comment, but the format would have been lost

  • 1
    don't take this the wrong way, but isn't this kind of redundant? It replaces the call to mono with a call to the script, but either way you still have to type in the app name... so you replace $ mono someapp.exe with ` $ callmono.sh someapp.exe`. just saying :P Commented Dec 17, 2010 at 0:20
  • I was thinking about that… ;) truth is, mono usually is on a crazy path, with the script you could put the full path, but yeah. Kick me. Commented Dec 17, 2010 at 1:49
  • that's true, if mono isn't in your $PATH this would allow you to call it without the absolute path in front. Commented Dec 17, 2010 at 18:35

I don't have a lot of experience with mono but you'll probably have to create an executable shell script that does the mono call for you. Something like:

$ vi abc.sh

mono abc.exe

$ chmod +x abc.sh
$ ./abc.sh
  • it didn't the task that prosseeek want, you just create another shell script for execute one specific file, but I think he want a general solution.
    – Am1rr3zA
    Commented Dec 16, 2010 at 8:06
  • @am1rr3za: agreed, but like i said I haven't used mono much so I don't know if there's a way to compile your executable so that you can run it directly on the command line. At least in the windows world, the OS knows how to identify a .net binary and load the .net CLR to interpret the MSIL. I don't know how that would work on Unix, unless the binary was compiled to machine language. But in .net, there has to be a runtime (I don't think you can directly execute a java app either). Commented Dec 16, 2010 at 15:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .