top | previous | next

FreeSurfer Setup and Configuration

Basic setup

To start using FreeSurfer, open a Terminal window by going to Finder then clicking Application -> Utilities -> Terminal. In order to load FreeSurfer you will need to type the following commands into the terminal window:

export FREESURFER_HOME=/Applications/freesurfer

You have the option of either typing those commands everytime you open a new terminal window OR adding those two lines somewhere in the .profile file in your home directory (If you don't already have a .profile file in your home directory, you can go ahead and create one). If you choose the latter method, FreeSurfer will load everytime you open a new terminal window and you won't have to type the two commands above. Regardless of the method you choose, once FreeSurfer is loaded, the terminal window should display some basic information and appear similar to the snapshot below.


The file Application/freesurfer/ is a bash script that will configure the environment so that FreeSurfer can be used. It sets a few environment variables, sources other shell scripts to set up support libraries, and performs some checks that need to be passed before FreeSurfer can start. This file needs to be 'sourced' before running any FreeSurfer binaries.


If you haven't done so already, obtain a license, and copy the license text from the email and create a file called license.txt in your $FREESURFER_HOME directory (e.g. /Applications/freesurfer). Permission issues will probably prevent you from saving to the Applications/freesurfer directory. In this case, your next best option is to save the license.txt file to you home directory, then use the terminal to manually copy it from your home directory, to the Application/freesurfer directory. Once you save the license.txt file to your home directory, open a terminal and issue the following command:

sudo cp ~/license.txt /Applications/freesurfer

You will be prompted for your password.

Ultimately, the goal is simply to get a file called license.txt with the contents of the email, into the /Applications/freesurfer directory. This can be done with gedit, vim, emacs, or countless other simple text editors.

Optional configuration settings

The defaults declared in the script should work for most installations. However, users should free to edit this file to customize certain environment variables:

1. Your declaration of the FREESURFER_HOME variable could be moved within the script.

2. The default SUBJECTS_DIR, which is $FREESURFER_HOME/subjects, is most likely the first variable that you will want to customize, as you may keep different groups of subjects in different directories. You may include the following either directly in the script, or prior to calling it:

3. If you do NOT intend to use the functional tools, then add the following line to the additional configuration section:

If you do intend to use the functional tools, then add these lines to your ~/matlab/startup.m file:

4. You may also wish to declare a path to an FSL installation you might have (required for TRACULA):

5. Save the file. You will need to source this file ( every time you want to use !Freesurfer.

Optional removal of third-party packages

Freesurfer includes in its distribution several third-party open-sourced packages which are required for Freesurfer to fully function. The distributed packages have not been modified from their source origins, so it is possible to delete the distributed package if an equivalent package is already installed on your system. Please be aware that the packages distributed with Freesurfer have been tested for compatibility with its tools.

The distributed packages, their version, and location are listed here:










*refers to MINC version **refers to Tcl/Tk version

To use a prior installed package, just move or delete the Freesurfer directory containing the package, and replace with a symbolic link to your own package. For instance, assuming an MNI toolkit is already installed in /usr/local/mni:

mv mni mni-backup
ln -s /usr/local/mni mni

The setup script will now point to those tools.

Testing FreeSurfer

Next: testing your FreeSurfer installation.

SetupConfiguration_Mac (last edited 2014-09-03 12:45:30 by ZekeKaufman)