To help with Linux packages, please join the F# Core Engineering Group. You can also submit an edit to this page.

Option 1: Use the F# Debian/Ubuntu packages

To use the latest stable version of the F# Debian/Ubuntu package, it is highly recommended that you:

  1. Follow these instructions.

  2. Then install packages mono-complete and fsharp.

     sudo apt-get update
     sudo apt-get install mono-complete fsharp
    

This installs fsharpc and fsharpi. If you don’t have access to these repositories, compile from source or see Option 6 below. Once installed, see the Linux and Cross-Platform Development Guide to go further.

F# is also available as a Debian package though the package tends to be less up-to-date than the packages above.


Option 2: Install Visual Studio Code

logo Visual Studio Code is a free, open source, cross platform source code editor supporting a lot of languages. F# is supported by the Ionide project and is a nice integration.

  1. Install Visual Studio Code for Linux
  2. Press Ctrl+P and enter the following to install the Ionide package for VS Code.

     ext install Ionide-fsharp
    

You will also need to install the F# packages from Step 1.


Option 3: Build and install the F# runtime, compiler and tools

  1. Get Mono, the cross-platform, open source .NET runtime implementation used by F#. Preferably use a package from your distribution or Xamarin. If this is not possible, install from source by following these instructions.

    Note that if you are installing to a private prefix, follow these instructions and ensure LD_LIBRARY_PATH includes the “lib” directory of that prefix location and PKG_CONFIG_PATH includes the “lib/pkgconfig” directory of that prefix location, e.g.

     export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/mono/lib/
     export PKG_CONFIG_PATH=/home/user/mono/lib/pkgconfig/
    
  2. Build and install the F# Compiler (open edition) from source. If using a VM or other memory-constrained system, be aware that errors during compilation may be due to insufficient memory (in particular error 137).

     sudo apt-get install autoconf libtool pkg-config make git automake
     git clone https://github.com/fsharp/fsharp
     cd fsharp
     ./autogen.sh --prefix /usr
     make
     sudo make install
    

    If installing to a different prefix, use the same prefix as for the Mono runtime above.

Once installed, see the Linux and Cross-Platform Development Guide to go further.


Option 4: F# for RHEL, CentOS, Amazon, Fedora w/ puppet/configuration management

To see an example of how to set up F# using puppet configuration management, see the example here, read the README and look inside the run file and the Vagrantfile file. It pulls down all required dependencies and starts vagrant to get you up and running EventStore (as a sample application).

With the epel, eventstore, mono and supervisor puppet module and a reference to packagecloud/haf/oss repository, you can install a full environment and running service in a couple of minutes:

class baseline {
  include ::epel
  include ::packagecloud

  packagecloud::repo { 'haf/oss':
    type => 'rpm',
  }
}

node default {
  include ::baseline

  class { 'mono':
    require => [
      Class['epel'],
      Packagecloud::Repo['haf/oss']
    ],
  }

  class { 'supervisor':
    require => [
      Class['epel'],
      Packagecloud::Repo['haf/oss']
    ],
  }

  include ::eventstore
}


Option 5: Get F# on Gentoo (Sabayon/Funtoo/Calculate)

From portage tree:

    emerge fsharp

Alternatively there is an overlay available with current versions of various .NET programs, including F#, FAKE, NuGet and others.

  1. Add the “dotnet” overlay from layman. (If you need to set it up, there is a Manual on the Gentoo site.)

    layman -a dotnet 
    
  2. Now you can build F#.

    emerge fsharp
    
  3. (Optional) There are emacs mode and monodevelop bindings, you can chose what you want by setting use flags alike in following example:

    USE="+emacs -monodevelop" emerge fsharpbinding
    

Once installed, see the Linux and Cross-Platform Development Guide to go further.


Option 6: Use a Vagrant VM on Windows

To use F# on Linux VMs on Windows, use F# with Vagrant.


Option 7: Slackware Slackbuild

  1. Get Mono Slackbuild from this page http://slackbuilds.org/repository/14.1/development/mono/ and run :

    ./mono.SlackBuild

  2. Get last FSharp Slackbuild from this page http://slackbuilds.org/repository/14.1/development/fsharp/ and run :

    ./fsharp.SlackBuild


Option 8: Using Nix on any Linux distribution or Mac OS X

  1. Install Nix if you don’t already have it:
    sudo mkdir /nix && sudo chown `id -u`.`id -g` /nix # create /nix
    sudo -k                                            # root privileges not needed any longer
    curl https://nixos.org/nix/install | bash          # install Nix
    . $HOME/.nix-profile/etc/profile.d/nix.sh          # update PATH accordingly
  1. Get F#
    nix-env -iA nixpkgs.fsharp
  1. You might also like…
    # List all the .NET packages that are readily available in the Nix package collection:
    nix-instantiate --eval --expr 'with import <nixpkgs> {}; lib.attrNames dotnetPackages' 

    # Download FSharp.Data in the Nix store and make it available in ./FSData
    nix-build '<nixpkgs>' -A dotnetPackages.FSharpData --out-link FSData

Find out more about the Nix package manager and NixOS (the purely functional Linux distribution based on it)

Explore (and contribute to) the collection of .NET applications and libraries in the Nixpkgs GitHub repo