Category: Mono Develop

write linux code on mac
June 13th, 2016 by ronny

write linux code on mac

How to write linux code on mac. Cross platform code is another term on write linux code code on mac, or any other system for that matter. There is a few things you need to download and install on your mac before starting writing linux code on mac.

First you need to download and install Mono Develop, or Xamarin Studio as it is called now. Xamarin Studio is a cross platform IDE for .net languages like C# and F#. If you want to program in C/C++ you should check out gcc instead. Xamarin Studio runs on Windows, Linux and OS X. And support most .net languages available today. Xamarin Studio is free and can be downloaded here:

Second you need Mono, the cross platform .net framework. Mono project is sponsored by Microsoft, but is free to anyone. You will need this to compile and run your projects written in Xamarin Studio. The cool thing about Mono Project is that you can deploy your programs to most major operating systems. Like Linux, Windows and OS X. As long as they are supported by Mono Project.

To get the Mono Project framework, go to:

To run your code on a Linux system you need to install Mono Project to the Linux system. This will vary from which Linux Distribution you are using. Debian based, Red Hat based or Suse based. Several of the Linux Distributions have a Mono Project package included in their repository, but rarely the latest. So I recommend going to their site and get it.

That is really the tools you need to write .net programs for Linux on a mac. A framework developed by Microsoft to run for Windows. There are even some community packages of Mono Project out there, even linked on their website. These are usually not tested by Xamarin.

Happy cross coding!

Posted in Linux, Mac, Mono Develop Tagged with: , ,

June 11th, 2014 by ronny

Linux Mint Mono Develop

Linux Mint Mono DevelopOn a standard Debian system this is very easy, and should be so on Linux Mint Mono Develop (the Debian version) too. Since you found this page I assume you have already tried to install Mono Develop. Anyway, lets take it from the start. First we run (of course):
apt-get install monodevelop

Then on a normal Debian system it would be ready to run and compile. On Linux Mint Mono Develop there is a few more things to do first. If you try to run Mono Develop at this point, nothing will happen. It doesn’t do anything at this point. So we try this:
apt-get install libmono-cairo2.0-cil

Now your Mono Develop will run just fine. So fire it up, and start a empty C# project, and try to compile the Hello World example. I then got an error saying: could not obtain a c# compiler. c# compiler not found for mono / .net 4.0

It seems like the compiler itself is missing. We will need to add the compiler too since all we got with the mlnodevelop package was the editor. We need a package called mono-gmcs to be able to compile our projects. So run this:
apt-get install mono-gmcs

I don’t understand why Linux Mint could not fix it from the beginning. I hope they get it right in the next version. Linux Mint is one of the better Linux Distros out there. I really enjoy working with Linux Mint.

Now your Linux Mint Mono Develop should be running and able to compile just fine.
To download Linux Mint please go to this page, their official distro page.
The version the call LMDE 2 is the second Debian based version. Based on Debian Jessie (or Debian 8).

Try again, and happy compiling!

Posted in Linux, Linux Mint, Mono Develop

April 27th, 2014 by ronny

source-codeA short example on how to use the .net MySql connector with Mono Develop.
First you need to make it available to your project.
Go to Project -> Edit References
Select the .Net Assembly tab. Then Navigate to your folder containing Mysql.Data.dll and select the file, and press ok.

Here is a short example program on how to insert a record into a test MySql database.

[sourcecode language=”csharp”]
using System;
using MySql.Data.MySqlClient;

namespace testmysql
class MainClass
public static void Main (string[] args)
// First a few variables, Assuming MySQL server is at and default port 3306
string cs = @"server=;port=3306;userid=testuser;password=testpass;database=testdb";
MySqlConnection myCon = null;
MySqlCommand myCmd = null;
Console.WriteLine ("Welcome to Test MySQL….");
// create mysql connector, and connect
Console.WriteLine("creating mysql connector…");
myCon = new MySqlConnection(cs);
// Create a sql string with sample data, inserted to testtable
string strQuery = "INSERT INTO testdb.testtable(testdata) values (‘Sample Data #1’);";
// Execute
myCmd = new MySqlCommand(strQuery, myCon);
// Close connection
Console.WriteLine("Data inserted to MySQL database successfully");

Happy programming!

Posted in Mono Develop, MySQL, Programming

April 25th, 2014 by ronny

MonoDevelopLogoHere is how to install a .net MySql connector for Mono Develop for Linux (Tested for Debian Variants).
First we is going to download the connector, and you will find it here:
Just remember to download the right version 😉

After we downloaded it, put it in a folder i.ex: ~/netConnector/
Rename it to Mysql.Data.dll (It is case sensitive)
It has been an issue for years, but when you download the connector it is all lower case. And if you don’t rename the file, it won’t work.

Next  we is going to do is to install it into to the GAC (Global Assembly Cache). This is needed for the Mono Develop to be able to use it. In general we put our .net dll’s here.
gacutil /i Mysql.Data.dll
You should be able to find the connector here: /usr/lib/mono/gac/

That’s it really. And it is ready to be used in your Mono Develop projects.

Happy programming!

Posted in Debian, Linux, Mono Develop, MySQL, Programming, Ubuntu