Mono is basically the .NET Framework on FreeBSD or other open source platforms. This allows development in C# on FreeBSD. C# is an extremely popular language that is not slowing down. It’s popularity stems from that fact that this language and its features allows for rapid development that is much faster than many other languages.
The version of Mono available in the ports tree is not the latest version available. Just like FreeBSD has a release version and a development version, Mono has a release version and a development version. The development version is so much newer that it is hard not to recommend it over the release version.
Step 1 – Install the latest ports
This is already documented here:
How to install ports on FreeBSD?
Step 2 – Install portshaker and portshaker-config
The team at BSD# have a tool called portshaker
that adds mono ports to the ports tree. Install it as follows.
#
# |
cd /usr/ports/ports-mgmt/portshaker-config
make BATCH=yes install |
Note: Notice I didn’t just install portshaker, I installed portshaker-config which has portshaker as a dependency, so you get both installed with one command.
Step 3 – Configure portshaker
The example portshaker.conf.example is configured correctly for default configurations, so all we need to do is copy it.
# cp /usr/local/etc/portshaker.conf.example /usr/local/etc/portshaker.conf
Step 4 – Run portshaker
Yes, it is that easy. Simply run portshaker.
# portshaker
Note: You may be prompted to merge a few files. I diffed and chose either install or continue each time.
Note: Running portshaker uses subversion to download so if you need to use an HTTP proxy, you have to configure subversion to use an HTTP proxy as it doesn’t use the FreeBSD HTTP_PROXY environment variable.
Your ports tree is now updated by portshaker.
Step 5 – Install mono
The mono port should now be updated to the latest version.
#
# |
cd /usr/ports/lang/mono
make BATCH=yes install |
Mono is now installed on your system.
There is an example of building a hello world app here:
C# (Mono) on FreeBSD