<> = Configuring your shell = If you have used the FSL installer your shell will have already been setup for running the FSL tools. However, there are situations where you may need to carry out this configuration by hand, for example when installing FSL on a multi-user computer. How you do this will depend on what shell you are using (see [[WhatShellAmIRunning|what shell am I using?]]). The instructions below will ask you to add lines of code to shell initialisation files. When doing this, make sure you are using a [[TextEditors|plain text]] editor, such as `nano`, `gedit`, or `emacs`. For example, if you are using the `bash` shell, you can edit the configuration file by typing `nano ~/.bash_profile` into a terminal. {{{#!wiki caution '''Take Care''' Modifying your locale globally (e.g. in .bash_profile) may result in issues with other scripts on your system - change with care! }}} == BASH/zsh/sh/ksh == Depending on the shell you are using, the FSL configuration commands will need to be added to a specific file: || Shell || Configuration file || || `bash` || `~/.bash_profile` || || `zsh` || `~/.zprofile` || || `sh` || `~/.profile` || || `ksh` || `~/.profile` || To configure FSL, you need to [[TextEditors|edit (or create)]] this file to add the following lines. Change the value of `FSLDIR` if you have installed FSL to a different location: {{{#!highlight bash numbers=disable # FSL Setup FSLDIR=/usr/local/fsl PATH=${FSLDIR}/share/fsl/bin:${PATH} export FSLDIR PATH . ${FSLDIR}/etc/fslconf/fsl.sh }}} {{{#!wiki caution '''Configuration for older FSL versions''' The lines above pertain to the latest FSL version (6.0.6 and newer). If you are using an older FSL version (6.0.5.2 or older), you must change the second line to: `PATH=${FSLDIR}/bin:${PATH}` (or `setenv PATH ${FSLDIR}/bin:${PATH}` if you are using `csh`/`tcsh`). }}} == csh/tcsh == User shell setup is stored in a file called .cshrc (csh and tcsh) or .tcsh (tcsh only) in your home folder (eg `~/.cshrc`), you need to [[TextEditors|edit (or create)]] this file to add the following lines. Change the value of `FSLDIR` if you have installed FSL to a different location: {{{#!highlight tcsh numbers=disable # FSL Setup setenv FSLDIR /usr/local/fsl setenv PATH ${FSLDIR}/share/fsl/bin:${PATH} source ${FSLDIR}/etc/fslconf/fsl.csh }}} = Customising FSL behaviour = You can change various aspects of FSL behaviour by using [[https://en.wikipedia.org/wiki/Environment_variable|environment variables]]. You can find a list of all of the environment variables that FSL understands on [[FslEnvironmentVariables|this page]]. When the FSL configuration commands in your shell profile are run, default settings are applied. You can override these default settings simply by specifying different values for the relevant environment variable. Perhaps the easiest method for customising FSL is to add your custom variable values to your shell initialisation script (see above). For example, if you are using the `bash` shell, and you wish to change the output file format of the FSL tools to uncompressed NIFTI images (`.nii` images, instead of the default `.nii.gz`), open `~/.bash_profile` in a plain text editor, and change the FSL configuration lines to this (making sure that the value for `FSLDIR` is correct for your system): {{{#!highlight bash numbers=disable # FSL Setup FSLDIR=/usr/local/fsl . ${FSLDIR}/etc/fslconf/fsl.sh PATH=${FSLDIR}/share/fsl/bin:${PATH} export FSLDIR PATH # My custom values for FSL environment variables export FSLOUTPUTTYPE=NIFTI }}} There are other places you could store your custom values for controlling FSL - look inside the `$FSLDIR/etc/fslconf/fsl.sh` file for more details. = System-wide setup = You have several options for automatically setting up FSL for all users on the computer, all beyond the scope of this document, but here are some suggestions on how you might go about this. 1. Change the template used for new user accounts (look in `/etc/skel` on Linux or `/System/Library/User Template/English.lproj/` on Mac OS X). New users will then get a suitably modified settings file. 1. Store the settings in an NFS shared folder. You could ensure that the default settings file looks for and sources a settings file on an NFS server. This is useful for a compute cluster as you only have to edit one file to have it change everywhere. 1. Modify the system-wide .profile or .cscrc file. On Mac OS X the files `/etc/profile` and `/etc/csh.cshrc` control this for all users, on Linux you can create files `fsl.sh` and `fsl.csh` in `/etc/profile.d` containing the settings. {{{#!wiki caution '''Take Care''' Be careful what you put in these files as you could stop people logging in! }}} = Localisation problems = FSL programs generally require a period to be used as the decimal separator ( e.g. 10.4 0.235 etc ). If your environment is configured to use a different character such as a comma then this may cause problems. Two potential fixes are to change the LC_NUMERIC variable value by: (i) typing the following lines into a terminal locally each time you want to run FSL, or (ii) globally modifying all terminals by adding the following lines to the .bash_profile ( or equivalent ): {{{ LC_NUMERIC=en_GB.UTF-8 export LC_NUMERIC }}}