So what have I been up to lately? Well, lots of different things. I have been taking it easy on the open source and blogging side of things as its been a hectic time of late in my personal life. This seems to be changing now so I’m starting to get all of the ideas spinning around in my head into physical reality, or virtual reality, or what ever you want to call it. Anyway, here’s the first post on the subject of programming in F# using MonoDevelop and Mono natively on Macs.
I have always been a fan of Mono but I have always shied away from using it in anger, this is mainly due to my Windows heritage and using Visual Studio almost exclusively at work. Times are changing though, and over the past few years I have been using Macs more and more. In fact the only place where I still use Windows natively is at work, so it makes sense to get a development environment up and running to support me.
Once the Beta of Mono 3.0 goes live it should contain within it a nice shiny new F# 3.0 installation, but until then we have to do a number of manual steps:
- Install Mono 3.0
- Install MonoDevelop
- Compile and install F#3.0
- Compile and install the MonoDevelop F# Language Binding
Install Mono 3.0
IF you think you already have these installed you can check which version you have by Navigating to the directory:
You should see version 3.0 in the list.
Also ensure that the
Current symbolic link points to Mono version 3.0, when I was first tried to get things running I couldn’t understand why I kept getting a version mismatches, this was because my link was pointing to Mono 2.10.9.
These instruction can also be found here but I thought it might be helpful to keep everything at hand here, if nothing else it will serve as a reference if I need to do this again or help anybody out.
#Make sure you have automake installed: brew install automake #First of all clone the F#3.0 repo from GitHub git clone git://github.com/fsharp/fsharp.git\ #change the directory cd fsharp #run autogen script pointing at the current version of Mono ./autogen.sh --prefix=/Library/Frameworks/Mono.framework/Versions/Current/ #run make to compile the code make #run make to install sudo make install
Once that’s all finished you can check everything is working by running
fsharpc F# Compiler for F# 3.0 (Open Source Edition) Freely distributed under the Apache 2.0 Open Source License error FS0207: No inputs specified
If you didn’t get a version 3.0 Compiler build displayed then check where
fsharpc is running from by using the
type fsharpc fsharpc is /usr/bin/fsharpc
You can now navigate there and check where the symbolic link is pointing to be using the
-l parameter of the
cd /usr/bin ls -l fsharpc lrwxr-xr-x 1 root wheel 51 3 Nov 09:33 fsharpc -> /Library/Frameworks/Mono.framework/Commands/fsharpc
When I first tried to get the F# 3.0 compiler installed I had all sorts of problem with the symbolic link pointing to the old version. I don’t know whether the installer had failed or whether an old version of the F# compiler or the F# language binding had caused issues, the process was so much smoother on my MacBook Pro as it was a clean install.
Build the MonoDevelop F# language binding
git clone git://github.com/fsharp/fsharpbinding.git cd fsharpbinding ./configure.sh make make install
That’s it we’re all done! Pretty easy stuff thanks to Ben Winkel and others for putting in some time to fix up the issues.
Now you should be able to fire up MonoDevelop and start building some F# code!
You can check the add-in is installed properly my opening the Add-in Manager from the MonoDevelop menu. The F# language binding should be shown in the list.
When you start a new solution you should now be presented with some F# specific options.
Until next time…