Uninstall any Mono and MonoDevelop you may have installed with your package manager. I found that the majority of package managers had versions of Mono that were a tad too old for running F#. Afterwards, download and compile the software listed below. You do this just as you would any other Linux program. These links will eventually point to outdated software, so make sure to check for the latest version.
Download the latest version of F# from Microsoft.
After unpackaging the F# software you just downloaded, run the following command as your superuser to install the F# libraries to the GAC.
At this point, F# is installed. You can start using fsc.exe and fsi.exe under Mono.
The remainder of this article deals with installing an Emac F# IDE. Its not perfect, but is the best thing I’ve found for developing F# projects on Linux.
After downloading the mode, modify or create file ~/.emacs by adding this content (plus a few path updates).
(setq load-path (cons "~/.emacs.d/fsharp" load-path)) (setq auto-mode-alist (cons '("\\.fs[iylx]?$" . fsharp-mode) auto-mode-alist)) (autoload 'fsharp-mode "fsharp" "Major mode for editing F# code." t) (autoload 'run-fsharp "inf-fsharp" "Run an inferior F# process." t) (setq inferior-fsharp-program "/your/path/fsharp/bin/fsi.exe --gui-") (setq fsharp-compiler "/your/path/fsharp/bin/fsc.exe")
I had to use the –gui- flag that I included on this command, it was to resolve an error that I kept receiving over the WinForm. I had to disable the GUI to allow the interpreter to run.
Move the fsharp directory from the fsharp-mode package you downloaded to ~/.emacs.d/ and you you’ll be all done installing the Emacs mode.
Open up an Emacs client, open a F# file to load the mode automatically (that would be any file ending in .fs or .fsx). To run the compiler, use C-c C-c and to invoke the command line interface run C-c C-s. The Emacs code comes with some pretty thorough documentation.
So, how do you know it is working? In Emacs, open up the command line interface with a C-c C-s. Now lets test out the interpreter by typing the following code.
let x = 4;;
If everything is set up correctly, you should see F# interactive terminal produce the following output.
val x : int = 4
Leave a Reply
You must be logged in to post a comment.