A few freesurfer modules, like fsfast and the subfield/nuclei segmentation tools, require the matlab runtime package (MCR). The MCR allows users to run distributed matlab-compiled programs without paying for a matlab license. The freesurfer command fs_install_mcr can be used to install this package. MCR version requirements are as follows.
To download the runtime for FS version 7, please install MCR 8.4 (R2014b) by running:
To download the runtime for FS version 6, please install MCR 8.0 (R2012b) by running:
NOTE: If the fs_install_mcr script is not available in your freesurfer distribution, it can be downloaded by running the following command:
cd $FREESURFER_HOME/bin && curl https://raw.githubusercontent.com/freesurfer/freesurfer/dev/scripts/fs_install_mcr -o fs_install_mcr && chmod +x fs_install_mcr
If the programs produce missing library errors...
If any of the matlab binaries error due to missing system libraries, try ensuring that the following are installed on your system.
on ubuntu: apt-get -y install libxt-dev libxext-dev libncurses5
on centos: yum -y install libXt libXext ncurses-compat-libs
Or, if you receive subfield errors (in freesurfer 7) indicating GLIBC_PRIVATE not defined, try updating a few files with the following command. This will be fixed in the 7.1.1 patch release.
bash <(curl -s https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/patches/fs_update_7.1_subfield_scripts.sh)
If you already have matlab installed...
If you already have matlab 2012b/2014b installed on your system, you do not need to install the runtime. Keep in mind that the matlab version must match the freesurfer requirement defined above. All you need to do is create a symbolic link named MCRv80/MCRv84 in your FreeSurfer directory that points to the main matlab install directory. The matlab root directory can be easily obtained by executing the matlab command matlabroot. It typically looks like /Applications/MATLAB_R2014b.app in OSX and /usr/local/matlab/8.4 in Linux. For example, if you already have matlab 2014b, just run the following to make it visible to freesurfer:
cd <FreeSurferRootDirectory> && ln -s <MatlabRootDirectory> MCRv84