If you have downloaded a container release there is no need to install FSL - please follow the usage instructions for the container.
FSL is normally installed by the installer script, fslinstaller.py, downloaded via the Download page. Selecting some Debian/Ubuntu versions on that page will take you to the Neurodebian site instead. As distributed, both these methods require no additional software to run. See the FAQ for help with running FSL on other Linux platforms (e.g. SuSE)
FSL Install Script
The fslinstaller.py script carries out the installation of FSL, configuring your environment to enable you to run FSL from a terminal window (e.g. (/Applications/Utilities/Terminal.app on macOS). The fslinstaller,py source code can be viewed here.
Running the installer (on macOS or Linux)
The installer requires access to the internet to be able to download the FSL software appropriate for your platform and runs from within a terminal session, so you need to open a terminal:
- Linux (Centos 7)
The Terminal application can be found in Applications > Utilities > Terminal menu
The Terminal application can be found in /Applications/Utilities
In the terminal change to the folder containing the fslinstaller.py file and run it with python; assuming that you wish to install into ~/fsl/ (the default) then just press the Return key when the installer asks where to install to. For example if you downloaded to your Downloads folder:
cd ~/Downloads python fslinstaller.py
Some systems do not have a command called python, and will print errors like python: command not found. If this happens try calling python3 fslinstaller.py or python2 fslinstaller.py.
macOS Ventura does not have Python installed by default - if you do not have any Python command available, you may need to install Xcode by running sudo xcode-select --install.
Once the install completes Linux users should log out (System (top right icon) > Log out) and log back in to complete the FSL setup. If you are accessing the Linux computer via a remote SSH session then close the SSH session and re-login. Apple macOS users should open a new terminal window to begin using FSL.
if you use Mathworks' MATLAB it will configure your startup.m file to allow you to use the FSL MATLAB functions.
Installing FSL into a different location
By default, FSL is installed into your user account home directory (at ~/fsl/), and so does not require administrative privileges. If you wish to install FSL to a different location (e.g. /usr/local/fsl/), or are installing FSL on a multi-user system, you may need to enter your administrator password before the installation can proceed. You can run the fslinstaller.py script as described above - the script will prompt you for your password when necessary.
If you do not have permission to use sudo then the installer will fail and you will need to either install into a folder belonging to your user or to run the installer as the root user. Should you install as root, see the configuring your account for FSL section for details on how to setup your user account for FSL.
The installer has some advanced options which, amongst other things, allows you to:
- customise the FSL installation location.
- automate the FSL installation - this is useful if you would like to call the installer from an automated script.
Type python fslinstaller.py -h for a list of all available options.
Checking the installation
Test that the environment and command line tools are set up correctly by doing the following:
Start a new Terminal session (File > Open Terminal under Linux/Gnome, Shell > New Window on macOS)
- Check that your environment is correct by typing: This should display the name of the directory that you installed FSL in.
- Check that your path is correct by typing: which should display a line like:
FLIRT version 6.0(although the version number might be different).
- Check that the miniconda environment installation completed successfully:
- which should display a line like:
In general, to run the FSL tools from the command line (within a terminal) you need to enter the program name in lower case (e.g. bet). Typing a command on its own (without any arguments or options) gives you a help message for that command.
Running the programs
The FSL command line tools are located in $FSLDIR/bin. In general command-line programs are lower case (e.g. bet); the GUI version capitalised (e.g. Bet).
To bring up a simple GUI which is just a menu of the main individual FSL GUI tools, just type fsl. You are now ready to run FSL
The fslinstaller.py script is capable of configuring Centos computers such that all user accounts can automatically use FSL without having to configure their accounts themselves. See Shell Setup for details.
Installing as root user on Linux
If you need to install as the root user, you can do this using these commands (again assuming you downloaded to the your Desktop folder):
cd ~/Desktop su -c "python fslinstaller.py"
and entering the root account password. You should now configure your user account to enable FSL use.
Using FSL from MATLAB
On macOS, the fslinstaller script will usually set this up for you so you should not need to do this. However, if the installer cannot configure MATLAB for some reason you may need to do this by hand.
FSL ships with several MATLAB scripts for loading NIFTI files. These libraries are dependent on FSL environment variables which may not be set when you start up MATLAB from your desktop environment. You can configure MATLAB to be FSL-aware by adding the following to your ~/Documents/MATLAB/startup.m file (create it if it doesn't already exist). Change the path in the first line if you have installed FSL to a different location:
% FSL Setup setenv( 'FSLDIR', '/usr/local/fsl' ); setenv('FSLOUTPUTTYPE', 'NIFTI_GZ'); fsldir = getenv('FSLDIR'); fsldirmpath = sprintf('%s/etc/matlab',fsldir); path(path, fsldirmpath); clear fsldir fsldirmpath;