Differences between revisions 1 and 2
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
=== OSX === ==== Linux ====

=== OSX ====
Line 8: Line 10:
  brew install cmake gcc5 glib
  brew install qt5 # optional (for building GUIs)
brew install cmake gcc5 glib
brew install qt5 # optional (for building GUIs)
Line 15: Line 17:
  tar -xzvf
tar -xzvf
Line 31: Line 33:
  cmake . cmake .
Line 37: Line 39:
  cmake . -DFS_PACKAGES_DIR="/path/to/packages" cmake . -DFS_PACKAGES_DIR="/path/to/packages"
Line 42: Line 44:
install path ==== Install Path ====
Line 47: Line 49:
  cmake . -DCMAKE_INSTALL_PREFIX="/path/to/desired/install" cmake . -DCMAKE_INSTALL_PREFIX="/path/to/desired/install"
Line 52: Line 54:
optimization ==== Optimization and Debugging ====
Line 54: Line 56:
modules ==== Modules ====

Build Requirements



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

brew install cmake gcc5 glib
brew install qt5 # optional (for building GUIs)

The remaining dependencies 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):

tar -xzvf


get source from github or fork --

get annex data --


Freesurfer supports both in-source and out-of-source builds using CMake (although tests can only be run from an in-source build). To configure a simple in-source build tree, enter the top-level directory of the repository and run:

cmake .

External users not developing on the Martinos filesystem will get an error saying "". To resolve this, you must point cmake to the full path of the packages directory configured above with the following flag:

cmake . -DFS_PACKAGES_DIR="/path/to/packages"

This path can also be set in an FS_PACKAGES_DIR environment variable, so that it doesn't need to be supplied on the command line for every new configuration.

Install Path

By default, freesurfer will install to /usr/local/freesurfer, but the install path can be configured with:

cmake . -DCMAKE_INSTALL_PREFIX="/path/to/desired/install"

Alternatively, this path can be set in an FS_INSTALL_DIR environment variable to avoid having to specify it for every configuration.

Optimization and Debugging



Once your build tree has been configured appropriately, freesurfer can be compiled with make and installed with make install. Additionally, unit and regression tests can be run with make test (previously make check) from individual subdirectories or from the top-level.

The current 8-threaded build time is roughly 6 minutes. Single-threaded builds can take between ? and ? minutes.

BuildGuide (last edited 2022-04-06 15:21:00 by AndrewHoopes)