Use F# on FreeBSD

Option 1: Build and install the F# runtime, compiler and tools from the FreeBSD ports collection

The commands for steps 1-4 must be run as ‘root’, e.g., using su.

Update your local copy of the ports collection:

If this is the first time you’re running portsnap on your system (e.g., you’ve just installed FreeBSD), you’ll need
to fetch a complete copy of the ports collection:

portsnap fetch extract

Otherwise, you can just update your local copy of the ports collection:

portsnap fetch update

Build and install Mono:

If you do not have an existing Mono installation, you can just build and install the latest version:

cd /usr/ports/lang/mono
make install clean BATCH=yes

If you already have an older version of Mono installed on your system, you must de-install the existing
version before installing the new version:

cd /usr/ports/lang/mono
make deinstall
make install clean BATCH=yes

NOTE : Mono is dependent on several other ports, which will automatically be compiled and installed (if necessary)
before proceeding with the Mono build/installation. The BATCH=yes option tells make to configure these
dependencies using their default build settings; if you want to modify these settings, leave this option off.

Build and install the F# compiler (open edition) and libraries:

cd /usr/ports/lang/fsharp
make install clean BATCH=yes

F# is now installed on your system. Confirm the installation was successful by launching F# interactive:

fsharpi

If you’re greeted with the F# interactive shell, the installation was successful – type #quit;; and press ENTER to exit.

Using F# on FreeBSD

Once installed, use fsharpi to start F# Interactive, and use fsharpc to compile.

Notes

The installation instructions above have been tested on both the i386 and amd64 builds of FreeBSD 9.1-RELEASE.
They should work for other versions as well – if they don’t work on your system, please contact the
fsharp-opensource group and/or the
freebsd-mono mailing list for assistance.