C# & Uncategorized 22 May 2007 07:16 pm

C# on Mac OS X

Turns out it’s a snap to start developing with C# on Mac OS X. The hard work is already done for you. First, download and install the latest Mono framework binary for OS X.

This blog from Brian Ray gives a nice Hello World example. The gist is:

  1. Compile with “/Library/Frameworks/Mono.framework/Commands/mcs hello.cs”
  2. Run with “/Library/Frameworks/Mono.framework/Commands/mono hello.exe”

TextMate fans can have it even easier. This close-to-anonymous C# TextMate bundle gives us the basics, including syntax coloring and some handy tab-completions. Install it by unzipping it and opening the bundle file. TextMate will install it for you.

To add a Run command, open the TextMate Bundle Editor, select the crisp new C# bundle, and add a New Command to it.

EXE_FILE=`echo $TM_FILEPATH | sed -e 's/\..*$//'`.exe
/Library/Frameworks/Mono.framework/Commands/mcs $TM_FILEPATH
/Library/Frameworks/Mono.framework/Commands/mono $EXE_FILE

picture-2.png Then, write your code and hit Cmd-R to compile and run the current source file. Snap!

Comments are closed.

Trackback This Post |