FreeSurfer Build Requirements

Freesurfer depends on a variety of third-party libraries, and this page recommends the best ways to install these dependencies on linux and mac. For further instructions on compiling freesurfer, visit the build guide.

Ubuntu

On ubuntu/debian, install a few of the required tools and libraries with apt-get:

sudo apt-get update
sudo apt-get install git wget tcsh build-essential gfortran
sudo apt-get install libblas-dev liblapack-dev zlib1g-dev
sudo apt-get install libxmu-dev libxmu-headers libxi-dev libxt-dev libx11-dev libglu1-mesa-dev

CentOS

On centos/redhat, install a few of the required tools and libraries with yum:

sudo yum update
sudo yum install git wget tcsh gcc gcc-c++ libgfortran-static make vim-common
sudo yum install lapack-devel lapack-static blas-devel blas-static zlib-devel
sudo yum install libX11-devel libXmu-devel mesa-libGL-devel

Further Linux Requirements

On some older linux distributions, package managers might only provide cmake v2, but version 3.9+ is required. The following will build and install cmake 3.12:

wget https://cmake.org/files/v3.12/cmake-3.12.0.tar.gz
tar -xzvf cmake-3.12.0.tar.gz && cd cmake-3.12.0
./bootstrap
make -j4
sudo make install
cd .. && rm -rf cmake-3.12.0 cmake-3.12.0.tar.gz

Additionally, python 3.5 or greater is required to configure and build freesurfer. If you don't have python3 installed, we recommend using anaconda python, which can be downloaded from https://www.anaconda.com/distribution.

The remaining dependencies, like vtk and itk, can be built locally using the build_packages.sh freesurfer script, or they can just be downloaded as prebuilt packages (recommended). The following will create a packages directory containing a set of required freesurfer dependencies (built on centos7). Make sure you point cmake to your packages directory when configuring freesurfer as described in the build guide.

wget https://surfer.nmr.mgh.harvard.edu/pub/data/fspackages/prebuilt/centos7-packages.tar.gz
tar -xzvf centos7-packages.tar.gz

MacOS

Freesurfer is supported on OSX El Capitan (10.11) and later, and we recommend using the homebrew package manager to install a few of the build dependencies:

brew install gcc5 cmake tcsh

Python 3.5 or greater is required to configure and build freesurfer. If you don't have python3 installed, we recommend using anaconda python, which can be downloaded from https://www.anaconda.com/distribution.

The remaining dependencies, like vtk and itk, can be built locally using the build_packages.sh freesurfer script, or they can just be downloaded as prebuilt packages (recommended). The following will create a packages directory containing a set of required freesurfer dependencies (built on OS X 10.11.6). Make sure you point cmake to your packages directory when configuring freesurfer as described in the build guide.

curl https://surfer.nmr.mgh.harvard.edu/pub/data/fspackages/prebuilt/osx10.11-packages.tar.gz -o osx10.11-packages.tar.gz
tar -xzvf osx10.11-packages.tar.gz

A Note Regarding FreeSurfer GUIs

The freesurfer GUIs, like freeview, are developed using the Qt framework, which we don't distribute in the prebuilt packages (for various reasons). Unless you'd like to build the GUIs, we'd recommend configuring the build with the cmake variable BUILD_GUIS set to OFF to avoid the Qt requirement.

BuildRequirements (last edited 2019-04-05 14:50:10 by AndrewHoopes)