Installing F# 2.0 on Mono/Linux

Yes, you can program F# on Linux. Thanks to the Mono project supported by Novell, the F# SDK provided by Microsoft can be run on Linux using the Mono CLR on Linux. You need to perform the following steps on your Linux installation:

1. Install the Mono development packages provided by your Linux distribution. After installing test your mono installation in the shell as follows

~> mono -V
Mono JIT compiler version 2.6.4 (tarball Mon Jul  5 13:23:55 UTC 2010)
Copyright (C) 2002-2010 Novell, Inc and Contributors.
 TLS:           __thread
 GC:            Included Boehm (with typed GC and Parallel Mark)
 SIGSEGV:       altstack
 Notifications: epoll
 Architecture:  x86
 Disabled:      none

2. Download the F# SDK from the Microsoft website into your home directory

3. Install the F# package and run the installation script

~> su
~ # cd /usr/local/lib
/usr/local/lib # unzip ~/
/usr/local/lib # cd FSharp-
/usr/local/lib/FSharp- # wget
/usr/local/lib/FSharp- # bash
-- Resigning FSharp.Core.dll with mono.snk
Assembly bin/FSharp.Core.dll signed.
-- Installing FSharp DLLS into the GAC
Installed bin/FSharp.Core.dll into the gac (/usr/lib/mono/gac)

4. Create the shell scripts fsc and fsi to launch the F# compiler and the interactive easily

~# cat /usr/local/bin/fsc
/usr/bin/mono /usr/local/lib/FSharp- $@

~# cat /usr/local/bin/fsi
/usr/bin/mono /usr/local/lib/FSharp- $@

5. Test your installation

~> fsc
Microsoft (R) F# 2.0 Compiler build
Copyright (c) Microsoft Corporation. All Rights Reserved.

error FS0207: No inputs specified

~> fsi

Microsoft (R) F# 2.0 Interactive build
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> #quit;;

- Exit...
This entry was posted in Installation. Bookmark the permalink.

2 Responses to Installing F# 2.0 on Mono/Linux

  1. 2sharp4u says:

    I just recently discovered that Scala is using ‘fsc’ for ‘fast scala compiler’, therefore, you may want to name the shell command for the F# compiler and interactive differently. I suggest to name them ‘fsc.exe’ and ‘fsi.exe’

  2. 2sharp4u says:

    If you encounter the following type of error in the interactive it may be due to an incompatibility issue between F# and Mono 2.8.
    > type a = A | B;;
    error FS0193: Operation is not supported.

    This error is fixed in the F# Community Technology Preview April 2011 which may be downloaded from the following link:
    You need to uninstall your F# installation (rm -Rf /usr/local/lib/FSharp- and reinstall according the above procedure.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s