The commands for steps 1-4 must be run as ‘root’, e.g., using
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
Adjust the permissions on the Mono registry folder. This is required for users to run
chmod -R 777 /usr/local/etc/mono/registry
F# is now installed on your system. Confirm the installation was successful by launching F# interactive:
If you’re greeted with the F# interactive shell, the installation was successful – type
#quit;; and press ENTER to exit.
Once installed, use
fsharpi to start F# Interactive, and use
fsharpc to compile.
fsharpi (starts F# interactive) fsharpc (F# compiler) xbuild (Builds .fsproj projects and .sln files, including ones authored in Visual Studio)
If running F# interactive in Emacs or another similar environment, use
to turn off console processing.
Some editors have specific support for F#, either builtin or through addons provided by the F# community:
Emacs. There is an F# mode for Emacs that extends Emacs with syntax highlighting and much more.
For console-only users, install the editors/emacs-nox11 port:
cd /usr/ports/editors/emacs-nox11 make install clean BATCH=yes
For desktop (GUI) users, install the editors/emacs port:
cd /usr/ports/editors/emacs make install clean BATCH=yes
emacs is installed, follow the directions in the fsharp-mode README to install the fsharp-mode package.
More information can be found in the FreeBSD Developers’ Handbook: Using Emacs as a Development Environment.