A step by step guide to installing an F# REPL environment on Linux
Getting set up on Linux
Installing on Linux is a bit more complicated than installing on Windows. I'm assuming that if you've opted for Linux, you've got a bit more technical experience. I hope so, or some of this is going to be a bit confusing! I've used Ubuntu Linux 12.10 in a default desktop install for these instructions. Your mileage may vary with other flavours. You'll also need at least 2GB of RAM in the computer, and plenty of free disk space.
To get started, you need to open up a Terminal, which we're going to use to install some packages to set up our programming environment.
We're going to use a tool called 'apt-get' to pull these packages down, along with a tool called 'sudo' to give apt-get permission to make changes to our system as it installs the packages.
At any stage, it is also possible that sudo will ask you for your password to allow the package to be installed. Just check that it is really sudo that is asking, and input your password if required.
The first package to install is Mono Develop. Type the following line, and press enter.
sudo apt-get install mono-devel
A bunch of information will scroll past, and then it will ask: Do you want to continue [Y/n]? Just hit enter (for 'yes'). It should all install OK, spewing a load of information at you as it does so.
Then, we need the mono compiler (type the line and press enter as before)
sudo apt-get install mono-gmcs
A bunch of information will scroll past, again, before it asks: Do you want to continue [Y/n]? Just hit enter (for 'yes'). It should all install OK.
We also need a package called autoconf.
sudo apt-get install autoconf
Another bunch of information will scroll past, and then it will ask: Do you want to continue [Y/n]? Hit enter (for 'yes') as before to complete installation.
Then there's a package called libtool
sudo apt-get install libtool
Another bunch of information will scroll past, and then it will ask: Do you want to continue [Y/n]? Hit enter (for 'yes') once again, and all should proceed happily.
Still not done. Now we need a package called g++
sudo apt-get install g++
Guess what. It asks: Do you want to continue [Y/n]? Hit enter (for 'yes') once again, and all should proceed happily. (You should be pretty familiar with apt-get by now.)
Then, we need to install a package called 'git'
sudo apt-get install git
Again, a bunch of information will scroll past, and again it will ask: Do you want to continue [Y/n]?. Hit enter (for yes), again.
Now, we're going to use git to pull down a later version of our Mono runtime (Version 3.0)
git clone https://github.com/mono/mono
You'll see some progress as it downloads (it will take a few minutes). Once it is down, we need to build and install it. So, switch to the mono directory:
cd mono
Then, we generate the build scripts for mono:
./autogen.sh
(Lots and lots of scrolling information, downloaded packages etc…)
Build mono:
make
(Plenty more of the scrolling text, consuming several more minutes of your life…maybe half an hour or so. Go and get something to drink.)
And install mono:
sudo make install
If that was all OK, we can move back up out of the mono folder.
cd ..
Right. With that done, we're now going to use git to pull down the F# development tools.
git clone https://github.com/fsharp/fsharp
You'll see some progress as it downloads. Next, switch to the fsharp directory
cd fsharp
Generate the F# build scripts:
./autogen.sh
(Lots and lots of scrolling information, downloaded packages etc…)
Build F#:
make
(Plenty more of the scrolling text, consuming yet more of your life…maybe another half an hour or so. Perhaps it is time to go and buy some healthy snacks.)
And install F#:
sudo make install
If that was all OK, we can move back up out of the fsharp folder.
cd ..
Now, we can start the interactive fsharp environment.
fsharpi
You should see the F# interactive environment start up as in the image above.
To quit the interactive F# environment, type
#quit;;